Closed daavic closed 7 months ago
While I think about it, is it possible to get confidence limits for the predictions?
In the covariance matrix for a hlme model obtained with vcov(hlme.model), I notice some of the column names are repeated with a .1 suffix. For example, I have one column with "intercept class1" and a second with "intercept class1.1". Why are they named like this - what do they represent - and which one would I use to formulate a confidence interval for a prediction?
Hi,
Here are my answers :
Best,
Viviane
Thanks very much Viviane - much appreciated.
I missed the draws argument in the CRAN document.
Before I got your reply I worked out another way of getting the CI.
var_beta <- vcov(hlme_mod)
var_beta <- (var_beta)[c(3:23), c(3:23)]
class2_names <- grep("class2$", rownames(var_beta), value = TRUE)
var_beta.class2 <- var_beta_fixed[class2_names, class2_names]
X <- model.matrix(~ s1+s2+s3+s4+s5+s6, data = newdata )
var_y_hat.class2 <- X %% var_beta.class2 %% t(X)
var.class2 <- (diag(var_y_hat.class2))
The draws argument is much better!
Thanks again Viviane for taking the time - lcmm is a very useful package.
Thanks very much for your lcmm package. I find it very useful for building GMM models with hlme()
I can't understand what predictY is doing after I build the GMM models.
Using time <- seq(from = min(dat.use$age), to = max(dat.use$age), length.out = 100)
time ranges from 7 to 50
I convert this to splines (the model was built using splines as the outcome is highly non-linear) spline.pred <- bs(age.eps, degree = 4, df = 6)
Then I give the splines to predictY() and I get my one hundred predictions
I adjust the time variable, time.eps <- time + eps
eps is small ~.4, (I am wanting to calculate derivatives)
I convert this to splines, spline.eps <- bs(time.eps, degree = 4, df = 6)
When I feed this to predictY(), I get exactly the same results as for the original splines without the eps.
I don't understand why this would be the case?
However, if I do time <- seq(from = min(dat.use$age), to = max(dat.use$age), length.out = 200)
The new 100 age inputs, between the original 100, get new predictions.
Am I doing something wrong?