mercredi 22 février 2017

Imposing Distribution in Random Coefficient Model in lme4 in R

say we want to estimate a random coefficient model using lme4. Ex ante we know that the random effects (intercept and slope regarding standLRT) are independent of each other. For instance:

rm(list = ls())

library(lme4)
library(mlmRev)

data(Exam)

# normexam = test scores
# school = school id
# standLRT = individual score on a different test
# schavg = average intake score_

test <- lmer(normexam ~ 1 + standLRT + schavg + (1 | school) + (standLRT - 1 | school), data = Exam)

In this model the estimated random coefficients follow a multivariate normal distribution:

hist(coef(test)$school[,"standLRT"])

How can I restrict the model and impose a different distribution on the to be estimated parameters?




Aucun commentaire:

Enregistrer un commentaire