0

使用されるライブラリは次のとおりです: ライブラリ (サバイバル) ライブラリ (スプライン) ライブラリ (ブート) ライブラリ (frailtypack) および使用される関数はライブラリ frailty pack にあります。
私のデータには、2 つの反復イベント (delta.stable と delta.unstable) と 1 つのターミナル イベント (delta.censor) があります。失業率 (u.rate) (四半期ごと) など、時間によって変化する説明変数がいくつかあるため、データセットは四半期ごとに分割されています。間違いを確認するのに役立つかもしれない場合に備えて、すぐ下のコードで使用されているサブサンプルへのリンクがあります。 https://www.dropbox.com/s/spfywobydr94bml/cr_05_males_services.rda 問題は、警告メッセージが表示されるまで実行に時間がかかることです。

Survival 関数の主な変数は次のとおりです。 2 つの繰り返しイベントがあります。 delta.unstable (unst.): 個人が不安定な仕事を見つけたときに値 1 を取ります。delta.stable (stable): 個人が安定した仕事を見つけると、値が 1 になります。そして、1 つのターミナル イベント delta.censor (d.censor): 個人が死亡、退職、または移住したときに値 1 を取ります。

row     id contadorbis unst. stable d.censor    .t0 .t
1   78  1   0   1   0   0   88
2   101 2   0   1   0   0   46
3   155 3   0   1   0   0   27
4   170 4   0   0   0   0   61
5   170 4   1   0   0   61  86
6   213 5   0   0   0   0   92
7   213 5   0   0   0   92  182
8   213 5   0   0   0   182 273
9   213 5   0   0   0   273 365
10  213 5   1   0   0   365 394
11  334 6   0   1   0   0   6
12  334 7   1   0   0   0   38
13  369 8   0   0   0   0   27
14  369 8   0   0   0   27  119
15  369 8   0   0   0   119 209
16  369 8   0   0   0   209 300
17  369 8   0   0   0   300 392

申請するmultivePenalと、次のメッセージが表示されます。

Error en aggregate.data.frame(as.data.frame(x), ...) : 
arguments must have same length
Además: Mensajes de aviso perdidos

In Surv(.t0, .t, delta.stable) : Stop time must be > start time, NA created
#### multivePenal function
fit.joint.05_malesP<multivePenal(Surv(.t0,.t,delta.stable)~cluster(contadorbis)+terminal(as.factor(delta.censor))+event2(delta.unstable),formula.terminalEvent=~1, formula2=~as.factor(h.skill),data=cr_05_males_serv,Frailty=TRUE,recurrentAG=TRUE,cross.validation=F,n.knots=c(7,7,7), kappa=c(1,1,1), maxit=1000, hazard="Splines")

Surv(.t0,.t,delta.stable)が含まれているかどうかを確認NAしましたが、 はありませんNA

さらに、frailtyPenal両方の可能な組み合わせの関数を同じデータに適用すると、関数はうまく実行され、結果が得られます。これを見て一週間かかりましたが、鍵が見つかりません。この問題に光を当てていただければ幸いです。

#delta unstable+death

enter code here

fit.joint.05_males<-frailtyPenal(Surv(.t0,.t,delta.unstable)~cluster(id)+u.rate+as.factor(h.skill)+as.factor(m.skill)+as.factor(non.manual)+as.factor(municipio)+as.factor(spanish.speakers)+ as.factor(no.spanish.speaker)+as.factor(Aged.16.19)+as.factor(Aged.20.24)+as.factor(Aged.25.29)+as.factor(Aged.30.34)+as.factor(Aged.35.39)+ as.factor(Aged.40.44)+as.factor(Aged.45.51)+as.factor(older61)+ as.factor(responsabilities)+
terminal(delta.censor),formula.terminalEvent=~u.rate+as.factor(h.skill)+as.factor(m.skill)+as.factor(municipio)+as.factor(spanish.speakers)+as.factor(no.spanish.speaker)+as.factor(Aged.16.19)+as.factor(Aged.20.24)+as.factor(Aged.25.29)+as.factor(Aged.30.34)+as.factor(Aged.35.39)+as.factor(Aged.40.44)+as.factor(Aged.45.51)+as.factor(older61)+ as.factor(responsabilities),data=cr_05_males_services,n.knots=12,kappa1=1000,kappa2=1000,maxit=1000, Frailty=TRUE,joint=TRUE, recurrentAG=TRUE)

###Be patient. The program is computing ... 
###The program took 2259.42 seconds 

#delta stable+death
fit.joint.05_males<frailtyPenal(Surv(.t0,.t,delta.stable)~cluster(id)+u.rate+as.factor(h.skill)+as.factor(m.skill)+as.factor(non.manual)+as.factor(municipio)+as.factor(spanish.speakers)+as.factor(no.spanish.speaker)+as.factor(Aged.16.19)+as.factor(Aged.20.24)+as.factor(Aged.25.29)+as.factor(Aged.30.34)+as.factor(Aged.35.39)+as.factor(Aged.40.44)+as.factor(Aged.45.51)+as.factor(older61)+as.factor(responsabilities)+terminal(delta.censor),formula.terminalEvent=~u.rate+as.factor(h.skill)+as.factor(m.skill)+as.factor(municipio)+as.factor(spanish.speakers)+as.factor(no.spanish.speaker)+as.factor(Aged.16.19)+as.factor(Aged.20.24)+as.factor(Aged.25.29)+as.factor(Aged.30.34)+as.factor(Aged.35.39)+as.factor(Aged.40.44)+as.factor(Aged.45.51)+as.factor(older61)+as.factor(responsabilities),data=cr_05_males_services,n.knots=12,kappa1=1000,kappa2=1000,maxit=1000, Frailty=TRUE,joint=TRUE, recurrentAG=TRUE)
###The program took 3167.15 seconds
4

3 に答える 3

1

使用されているパッケージに関する情報も、実行に必要なデータも提供されてmultivepenalfrailtyPenalないため、私はその部分だけを手伝うことができますSurv(たまたまそのパッケージが読み込まれていたため)。

提供されたSurv警告メッセージ ( ) は、変数( の引数、警告では「開始時間」と呼ばれる) および/または(引数、警告では「停止時間」 ) にIn Surv(.t0, .t, delta.stable) : Stop time must be > start time, NA created異常があることを示唆しています。簡単な例でこの可能性を確認します.t0timeSurv.ttime2

# read the data you feed `Surv` with
df <- read.table(text = "row     id contadorbis unst. stable d.censor    .t0 .t
1   78  1   0   1   0   0   88
2   101 2   0   1   0   0   46
3   155 3   0   1   0   0   27
4   170 4   0   0   0   0   61
5   170 4   1   0   0   61  86
6   213 5   0   0   0   0   92
7   213 5   0   0   0   92  182
8   213 5   0   0   0   182 273
9   213 5   0   0   0   273 365
10  213 5   1   0   0   365 394
11  334 6   0   1   0   0   6
12  334 7   1   0   0   0   38
13  369 8   0   0   0   0   27
14  369 8   0   0   0   27  119
15  369 8   0   0   0   119 209
16  369 8   0   0   0   209 300
17  369 8   0   0   0   300 392", header = TRUE)

# create survival object
mysurv <- with(df, Surv(time = .t0, time2 = .t, event = stable))
mysurv

# create a new data set where one .t for some reason is less than .to
# on row five .t0 is 61, so I set .t to 60
df2 <- df
df2$.t[df2$.t == 86] <- 60

# create survival object using new data which contains at least one Stop time that is less than Start time
mysurv2 <- with(df2, Surv(time = .t0, time2 = .t, event = stable))

# Warning message:
#  In Surv(time = .t0, time2 = .t, event = stable) :
#  Stop time must be > start time, NA created
# i.e. the same warning message as you got

# check the survival object
mysurv2

# as you can see, the fifth interval contains NA
# I would recommend you check .t0 and .t in your data set carefully 
# one way to examine rows where Stop time (.t) is less than start time (.t0) is:
df2[which(df2$.t0 > df2$.t), ]

私はよくmultivepenal知りませんが、NA の間隔を含むサバイバル オブジェクトを受け入れないようですが、そうする可能frailtyPenal性があります。

于 2013-09-08T11:36:20.743 に答える