Hello all. I am trying to run PAN, multilevel multiple imputation program, in R to impute missing data in a longitudinal dataset. I could successfully run the multiple imputation when I only imputed one variable. However, when I tried to impute a time-varying covariate as well as a response variable, I received an error message, “Error: subscript out of bounds.” Can anyone tell if my commands contain any mistakes? First I imported SAS dataset ‘sim’ which includes a response variable ‘MIY1’, a time-varying covariate ‘TCOV1’, TIME, GROUP (0 or 1), and ID. 200 participants were included and measurement occurred six times. Approximately 25% of participants dropped out at end.> sim <- read.xport('c:\\xptds.dat') > > int <- rep(1,1200) > y <- cbind(sim$MIY1,sim$TCOV1) > subj <- sim$ID > pred <- cbind(int, sim$TIME, sim$GROUP) > > xcol <- 1:3 > zcol <- 1> prior <- list(a=2,Binv=4,c=2,Dinv=4)> result <-pan(y,subj,pred,xcol,zcol,prior,seed=13579,iter=1000) Error: subscript out of bounds By the way, I also received the same error message when I tried to include intercept and time in Zcol, a matrix for random effect specification. I used command “ zcol <- 1:2”. Does anybody know if this error is due to sample size/proportion of missing data or due to command mistake? I truly appreciate any feedbacks. Best regards, Eishi
Please read the posting guide. It tells you to provide (a) small reproducible examples and (b) 'If the question relates to a package that is downloaded from CRAN try contacting the package maintainers first. You can also use find("functionname") and packageDescription("packagename") to find this information.' Uwe Ligges AC wrote:> Hello all. I am trying to run PAN, multilevel > multiple imputation program, in R to impute missing > data in a longitudinal dataset. I could successfully > run the multiple imputation when I only imputed one > variable. However, when I tried to impute a > time-varying covariate as well as a response variable, > I received an error message, ?Error: subscript out of > bounds.? Can anyone tell if my commands contain any > mistakes? > > First I imported SAS dataset ?sim? which includes a > response variable ?MIY1?, a time-varying covariate > ?TCOV1?, TIME, GROUP (0 or 1), and ID. 200 > participants were included and measurement occurred > six times. Approximately 25% of participants dropped > out at end. > > >>sim <- read.xport('c:\\xptds.dat') >> >>int <- rep(1,1200) >>y <- cbind(sim$MIY1,sim$TCOV1) >>subj <- sim$ID >>pred <- cbind(int, sim$TIME, sim$GROUP) >> >>xcol <- 1:3 >>zcol <- 1 > > >>prior <- list(a=2,Binv=4,c=2,Dinv=4) > > >>result <- > > pan(y,subj,pred,xcol,zcol,prior,seed=13579,iter=1000) > Error: subscript out of bounds > > > By the way, I also received the same error message > when I tried to include intercept and time in Zcol, a > matrix for random effect specification. I used > command ? zcol <- 1:2?. Does anybody know if this > error is due to sample size/proportion of missing data > or due to command mistake? > > I truly appreciate any feedbacks. > Best regards, > Eishi > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html