Hi,
I would like to know how the BLUPs are calculated in a random intercept and slope mixed model
Please see the following code:
//########################
use https://stats.idre.ucla.edu/stat/sta...a/tolerance_pp, clear
mixed tolerance time exposure male || id: time, reml estmetric
mixed tolerance time exposure male || id: time, reml
predict double pred, xb
predict double rslope rintercept, reffects
gen double fitted_v1=(_b[_cons]+rintercept) + _b[male]*male + _b[exposure]*exposure + (_b[time]*time + rslope*time)
predict fitted_v2, fitted
//########################
Please can anyone tell me how the variables rslope rintercept are calculated? I would like to know how these variables are calculated.
I have been able to obtain successfully the rintercept variable in the context of a random intercept model, but I don't know how to do it in the context of random intercept and slope model:
//########################
use https://stats.idre.ucla.edu/stat/sta...a/tolerance_pp, clear
mixed tolerance time exposure male || id:, reml
predict double pred, xb
generate double res = tolerance - pred
egen double ml = mean(res), by(id)
mixed tolerance time exposure male || id:, reml estmetric
bysort id: gen N=_N
gen double shrinkage=exp([lns1_1_1]_cons)^2/(exp([lns1_1_1]_cons)^2 + exp([lnsig_e]_cons)^2/N)
generate double rintercept1 = shrinkage*ml
predict double rintercept2, reffects // rintercept1 and rintercept2 are the same
gen double fitted2=pred+rintercept1
//########################
Thank you in advance for your help,
Andrew
I would like to know how the BLUPs are calculated in a random intercept and slope mixed model
Please see the following code:
//########################
use https://stats.idre.ucla.edu/stat/sta...a/tolerance_pp, clear
mixed tolerance time exposure male || id: time, reml estmetric
mixed tolerance time exposure male || id: time, reml
predict double pred, xb
predict double rslope rintercept, reffects
gen double fitted_v1=(_b[_cons]+rintercept) + _b[male]*male + _b[exposure]*exposure + (_b[time]*time + rslope*time)
predict fitted_v2, fitted
//########################
Please can anyone tell me how the variables rslope rintercept are calculated? I would like to know how these variables are calculated.
I have been able to obtain successfully the rintercept variable in the context of a random intercept model, but I don't know how to do it in the context of random intercept and slope model:
//########################
use https://stats.idre.ucla.edu/stat/sta...a/tolerance_pp, clear
mixed tolerance time exposure male || id:, reml
predict double pred, xb
generate double res = tolerance - pred
egen double ml = mean(res), by(id)
mixed tolerance time exposure male || id:, reml estmetric
bysort id: gen N=_N
gen double shrinkage=exp([lns1_1_1]_cons)^2/(exp([lns1_1_1]_cons)^2 + exp([lnsig_e]_cons)^2/N)
generate double rintercept1 = shrinkage*ml
predict double rintercept2, reffects // rintercept1 and rintercept2 are the same
gen double fitted2=pred+rintercept1
//########################
Thank you in advance for your help,
Andrew
Comment