# [R] Weights and coxph

From: mah <harwood262_at_gmail.com>
Date: Fri, 13 Jun 2008 11:43:17 -0700 (PDT)

Mike

> test1

\$time
[1] 4 3 1 1 2 2 3

\$status
[1] 1 NA 1 0 1 1 0

\$x
[1] 0 2 1 1 1 0 0

\$sex
[1] 0 0 0 0 1 1 1

\$wt
[1] 3 3 3 3 3 3 3

> test_freq

time status x sex

```1     4      1 0   0
2     4      1 0   0
3     4      1 0   0
4     3     NA 2   0
5     3     NA 2   0
6     3     NA 2   0
7     1      1 1   0
8     1      1 1   0
9     1      1 1   0
10    1      0 1   0
11    1      0 1   0
12    1      0 1   0
13    2      1 1   1
14    2      1 1   1
15    2      1 1   1
16    2      1 0   1
17    2      1 0   1
18    2      1 0   1
19    3      0 0   1
20    3      0 0   1
21    3      0 0   1
```

> t1 <- coxph( Surv(time, status) ~ x + strata(sex), data=test1, weights=wt)
> summary(t1)
Call:
coxph(formula = Surv(time, status) ~ x + strata(sex), data = test1,

weights = wt)

n=6 (1 observation deleted due to missingness)   coef exp(coef) se(coef) z p
x 1.17 3.22 0.744 1.57 0.12

exp(coef) exp(-coef) lower .95 upper .95 x 3.22 0.311 0.749 13.8

Rsquare= 0.353 (max possible= 0.999 )

```Likelihood ratio test= 2.61  on 1 df,   p=0.106
Wald test            = 2.47  on 1 df,   p=0.116
Score (logrank) test = 2.67  on 1 df,   p=0.102

> cox.zph(t1)

rho   chisq     p
```

x -0.0716 0.00598 0.938
> t_freq <- coxph( Surv(time, status) ~ x + strata(sex), data=test_freq)
> summary(t_freq)

Call:
coxph(formula = Surv(time, status) ~ x + strata(sex), data = test_freq)

n=18 (3 observations deleted due to missingness)

```  coef exp(coef) se(coef)    z     p
x 1.41      4.09    0.756 1.86 0.063

exp(coef) exp(-coef) lower .95 upper .95
x      4.09      0.245     0.929      18.0

```

Rsquare= 0.185 (max possible= 0.879 )

```Likelihood ratio test= 3.69  on 1 df,   p=0.0549
Wald test            = 3.47  on 1 df,   p=0.0626
Score (logrank) test = 3.84  on 1 df,   p=0.0499

> cox.zph(t_freq)

rho  chisq     p
```

x -0.0697 0.0526 0.819

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat 14 Jun 2008 - 00:59:41 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 15 Jun 2008 - 18:30:40 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.