You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To put it simply, I want to estimate a random effects model with censored data.
I am trying to use the pldv function to do this.
However, I have not been able to implement double threshold censoring.
Every time I try to use right censorship, I'm faced with:
"Error in maxOptim(fn = fn, grad = grad, hess = hess, start = start, method = "BFGS", :
NA in initial gradient"
Here is a toy example to replicate the problems:
(it more or less corresponds to the lab experiment pilot data I tried to use)
Data generation:
library(plm)# Number of individualsNb_simulation=20# Individual random effects (temporal invariant)effect_indivs <- rnorm(Nb_simulation,0,3.5)# Treatments effects (effect_temps <- c(1.5,3.8,4.0,3.7,5.4)# Dataset creationdata_sim <- data.frame(temps1=effect_indivs + effect_temps[1],temps2=effect_indivs + effect_temps[2],temps3=effect_indivs + effect_temps[3],temps4=effect_indivs + effect_temps[4],temps5=effect_indivs + effect_temps[5])# Independant error term generationdata_sim <- data_sim + rnorm(Nb_simulation*5,0,3.5)# Both side censorship data_sim[data_sim<0] <- 0data_sim[data_sim>10] <- 10# Dataset reshapingTob_value <- data.frame(valeurs_pl=c(data_sim$temps1,data_sim$temps2,data_sim$temps3,data_sim$temps4,data_sim$temps5
),temps=as.factor(c(rep(1,Nb_simulation),rep(2,Nb_simulation),rep(3,Nb_simulation),rep(4,Nb_simulation),rep(5,Nb_simulation))),inds=as.factor(rep(1:Nb_simulation,5)))# Use of pdata.frameTob_panel <- pdata.frame(Tob_value,index=c("inds","temps"))
One side censorship
Lower treshold
Tob_mod_inf <- pldv(valeurs_pl ~ 1 + temps, data = Tob_panel, model = "random", R = 128, lower = 0, sample = "cens", method = "bfgs")
summary(Tob_mod_inf)
Everything seems to be working fine.
Upper treshold
Tob_mod_sup <- pldv(valeurs_pl ~ 1 + temps, data = Tob_panel, model = "random", R = 128, upper = 10, sample = "cens", method = "bfgs")
summary(Tob_mod_sup) # /!\ error
Hi,
To put it simply, I want to estimate a random effects model with censored data.
I am trying to use the pldv function to do this.
However, I have not been able to implement double threshold censoring.
Every time I try to use right censorship, I'm faced with:
"Error in maxOptim(fn = fn, grad = grad, hess = hess, start = start, method = "BFGS", :
NA in initial gradient"
Here is a toy example to replicate the problems:
(it more or less corresponds to the lab experiment pilot data I tried to use)
Data generation:
One side censorship
Lower treshold
Everything seems to be working fine.
Upper treshold
Which gives an error
Two sides censorship
Same error
Thank you in advance for your help,
Tanguy
The text was updated successfully, but these errors were encountered: