File: singtest.Rout.save

package info (click to toggle)
survival 2.36-14-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 3,500 kB
  • sloc: asm: 7,352; ansic: 5,369; makefile: 2
file content (50 lines) | stat: -rw-r--r-- 1,802 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

R version 2.12.2 (2011-02-25)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> options(na.action=na.exclude) # preserve missings
> options(contrasts=c('contr.treatment', 'contr.poly')) #ensure constrast type
> library(survival)
Loading required package: splines
> 
> #
> # A simple test of the singular=ok option
> #
> test1 <- data.frame(time=  c(4, 3,1,1,2,2,3),
+ 		    status=c(1,NA,1,0,1,1,0),
+ 		    x=     c(0, 2,1,1,1,0,0))
> 
> temp <- rep(0:3, rep(7,4))
> 
> stest <- data.frame(start  = 10*temp,
+ 		    stop   = 10*temp + test1$time,
+ 		    status = rep(test1$status,4),
+ 		    x      = c(test1$x+ 1:7, rep(test1$x,3)),
+ 		    epoch  = rep(1:4, rep(7,4)))
> 
> fit1 <- coxph(Surv(start, stop, status) ~ x * factor(epoch), stest)
Warning message:
In coxph(Surv(start, stop, status) ~ x * factor(epoch), stest) :
  X matrix deemed to be singular; variable 2 3 4
> fit1$coef    # elements 2:4 should be NA
               x   factor(epoch)2   factor(epoch)3   factor(epoch)4 
       0.1041579               NA               NA               NA 
x:factor(epoch)2 x:factor(epoch)3 x:factor(epoch)4 
       1.5726996        1.5726996        1.5726996 
> all.equal(is.na(fit1$coef), c(F,T,T,T,F,F,F), check.attributes=FALSE)
[1] TRUE
>