Skip to content

question about random coefficients model (RCM)

1 message · Malcolm Fairbrother

#
Dear Jose,

Did you ever figure out how to replicate Western's (1998) model using lme4?

I've figured out how to replicate precisely the "Interactions Model" in his Table 2, but not the "Hierarchical Model"--see code below. I'm not sure if the issue is the estimation technique (REML rather than a Gibbs sampler), or if I've just not understood the model. I've also tried using MCMCglmm but am not having much more luck with that--other than the intercept, all fixed effects span 0, unlike in the results that Western reports.

I'd be interested to know if you found a way to replicate Western's results more precisely.

Cheers,
Malcolm


library(pcse) # includes the relevant dataset
data(agl)
agl2 <- agl[agl$year!=1970,]
agl2$lgrowth <- as.vector(unlist(by(agl, agl$country, function(x) x$growth[-15]))) # create lagged y variable
for (i in c(5:8, 11)) { agl2[,i] <- as.vector(unlist(by(agl2, agl2$country, function(x) scale(x[,i], scale=F)))) } # to center the time-series predictors within countries
w98.eq11 <- lm(growth ~ lgrowth*central + opengdp*central + openex*central + openimp*central + leftc*central, data=agl2) # matches the "Interactions Model" in Table 2
library(lme4)
w98.eq13 <- lmer(growth ~ lgrowth*central + opengdp*central + openex*central + openimp*central + leftc*central + (lgrowth + opengdp + openex + openimp + leftc | country), data=agl2)
data.frame(round(fixef(w98.eq13), 3), round(coef(w98.eq11), 3)); ranef(w98.eq13)
library(MCMCglmm)
prior <- list(R = list(V = 1, nu = 0), G = list(G1 = list(V = diag(6), nu = 1)))
w98.eq13.MCMC <- MCMCglmm(growth ~ lgrowth*central + opengdp*central + openex*central + openimp*central + leftc*central, random=~us(1 + lgrowth + opengdp + openex + openimp + leftc):country, data=agl2, prior=prior)