Hi,

I've tried to run the multiple imputation for longitudinal data using Pan in 
R.
The trimmed data consist 10 individuals across 4 time points.
Following the example in panex.R, I imputated the model with one y variable 
and only random intercept.
It worked well.
The next step for me is to imputate a model with one y variable and both 
random intercept and slope.
The program ran well, but did not imputate any of my missing values.
I attached my codes in the following. Did I do anything wrong in the codes?

I am confused with the setting of xcol and zcol (and of course the "pred").
Do anyone know how to set these matrices when including both random 
intercept and slope or when having 2 or more y's?

Any suggestions would be appreciated. Thanks!

Yi-fu

>library(pan)
> y <- c(5,8,NA,10,
+        2,NA,NA,NA,
+        10,10,8,NA,
+        NA,10,4,NA,
+        2,8,NA,9,
+        NA,NA,NA,NA,
+        8,6,NA,5,
+        6,NA,NA,NA,
+        10,2,NA,NA,
+        6,8,NA,2)
> subj <- c(1,1,1,1,
+           2,2,2,2,
+           3,3,3,3,
+           4,4,4,4,
+           5,5,5,5,
+           6,6,6,6,
+           7,7,7,7,
+           8,8,8,8,
+           9,9,9,9,
+           10,10,10,10)
> pred <- cbind(int=rep(1,40),
+    dummy1=rep(c(1,0,0,0),10),
+    dummy2=rep(c(0,1,0,0),10),
+    dummy3=rep(c(0,0,1,0),10),
+    dummy4=rep(c(0,2,4,6),10))
> xcol <- 1:4
> zcol <- c(1,5)
> a <- array (2,dim=c(2,2))
> prior <- list(a=1,Binv=1,c=2,Dinv=a)
> result <- pan(y,subj,pred,xcol,zcol,prior,seed=25679,iter=5000)
> result$y
 [1]   5   8 NaN  10   2 NaN NaN NaN  10  10   8 NaN NaN  10   4 NaN   2   8 
NaN
[20]   9 NaN NaN NaN NaN   8   6 NaN   5   6 NaN NaN NaN  10   2 NaN NaN   6 
8
[39] NaN   2
>


	[[alternative HTML version deleted]]


