调查包(生存分析)

时间:2015-09-28 16:16:14

标签: r survey

我正在使用survey包来分析纵向数据库。数据看起来像

personid    spellid long.w  Dur rc  sex 1   10  age
1   1   278 6.4702295519    0   0   47  20  16
2   1   203 2.8175129012    1   1   126 87  62
3   1   398 6.1956669321    0   0   180 6   37
4   1   139 7.2791061847    1   0   104 192 20
7   1   10  3.6617503439    1   0   18  24  25
8   1   3   2.265464682 0   1   168 136 40
9   1   134 6.3180994022    0   1   116 194 35
10  1   272 6.9167936912    0   0   39  119 45
11  1   296 5.354798213 1   1   193 161 62

在变量SEX之后,我有10个自举权重,然后是变量Age。

纵向重量在列long.w

中给出

我正在使用以下代码。

data.1 <- read.table("Panel.csv", sep = ",",header=T)
library(survey)
library(survival)

#### Unweigthed model
mod.1 <- summary(coxph(Surv(Dur, rc) ~ age + sex, data.1))
mod.1
coxph(formula = Surv(Dur, rc) ~ age + sex, data = data.1)

  n= 36, number of events= 14 

          coef  exp(coef)   se(coef)     z Pr(>|z|)
age -4.992e-06  1.000e+00  2.291e-02 0.000    1.000
sex  5.277e-01  1.695e+00  5.750e-01 0.918    0.359

    exp(coef) exp(-coef) lower .95 upper .95
age     1.000       1.00    0.9561     1.046
sex     1.695       0.59    0.5492     5.232

Concordance= 0.651  (se = 0.095 )
Rsquare= 0.024   (max possible= 0.858 )


### ---  Weights 
weights <- data.1[,7:16]*data.1$long.w

panel <-svrepdesign(data=data.1,
                         weights=data.1[,3],
                         type="BRR",
                         repweights=weights,
                         combined.weights=TRUE
                   )

#### Weighted model
mod.1.w <- svycoxph(Surv(Dur,rc)~ age+ sex ,design=panel)
summary(mod.1.w)
Balanced Repeated Replicates with 10 replicates.
Call:
svycoxph.svyrep.design(formula = Surv(Dur, rc) ~ age + sex, design = panel)

  n= 36, number of events= 14 

      coef exp(coef) se(coef)     z Pr(>|z|)    
age 0.0198    1.0200   0.0131 1.512    0.131    
sex 1.0681    2.9098   0.2336 4.572 4.84e-06 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

    exp(coef) exp(-coef) lower .95 upper .95
age      1.02     0.9804    0.9941     1.047
sex      2.91     0.3437    1.8407     4.600

Concordance= 0.75  (se = 0.677 )
Rsquare= NA   (max possible= NA )
Likelihood ratio test= NA  on 2 df,   p=NA
Wald test            = 28.69  on 2 df,   p=5.875e-07
Score (logrank) test = NA  on 2 df,   p=NA

### ---- 
> panel.2 <-svrepdesign(data=data.1,
+                          weights=data.1[,3],
+                          type="BRR",
+                          repweights=data.1[,7:16],
+                          combined.weights=FALSE,
+                    )
Warning message:
In svrepdesign.default(data = data.1, weights = data.1[, 3], type = "BRR",  :
  Data look like combined weights: mean replication weight is 101.291666666667  and mean sampling weight is 203.944444444444

mod.2.w <- svycoxph(Surv(Dur,rc)~ age+ sex ,design=panel.2)
> summary(mod.2.w)
Call: svrepdesign.default(data = data.1, weights = data.1[, 3], type = "BRR", 
    repweights = data.1[, 7:16], combined.weights = FALSE, )
Balanced Repeated Replicates with 10 replicates.
Call:
svycoxph.svyrep.design(formula = Surv(Dur, rc) ~ age + sex, design = panel.2)

  n= 36, number of events= 14 

      coef exp(coef) se(coef)     z Pr(>|z|)    
age 0.0198    1.0200   0.0131 1.512    0.131    
sex 1.0681    2.9098   0.2336 4.572 4.84e-06 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

    exp(coef) exp(-coef) lower .95 upper .95
age      1.02     0.9804    0.9941     1.047
sex      2.91     0.3437    1.8407     4.600

Concordance= 0.75  (se = 0.677 )
Rsquare= NA   (max possible= NA )
Likelihood ratio test= NA  on 2 df,   p=NA
Wald test            = 28.69  on 2 df,   p=5.875e-07
Score (logrank) test = NA  on 2 df,   p=NA

纵向重量之和为7,342。事件总数必须在2,357左右,审查后的观察总数为4,985(#34;#34;共有7,342人

模型mod.1.wmod.2.w是否考虑了纵向权重?如果这样做,为什么摘要报告只有n = 36,事件数= 14?

如果我采用其他统计数据,设计效果很好。例如,当我考虑data.1时,svymean(~Dur, panel.2)中不考虑抽样设计的Dur的平均值约为4.9和5.31。

0 个答案:

没有答案