Displaying 2 results from an estimated 2 matches for "sub_noise".
2007 Aug 13
0
R^2 for multilevel models
...as been done and, given its absence from the lmer
output, refuted somewhere. A reference would be lovely.
Code below.
Many thanks,
Andy
#################################################################
require(lme4)
# First generate some data
people = 100
obs = 4
# The random intercepts:
sub_noise = data.frame(id = 1:people, rand_int = rnorm(people,0,60))
# Merge everything
id = rep(1:people,obs)
thedata = data.frame(id)
thedata = merge(sub_noise, thedata)
thedata$x = rep(1:obs,people)
# Setup the relationship between x and y
thedata$y = 23*thedata$x + 20 + thedata$rand_int...
2007 Oct 08
0
Residuals for binomial lmer fits
...ffects with random effects flattened to
predict y's. Code below.
Best wishes,
Andy
##############################################################
require(lme4)
set.seed(0)
# Data for 100 people, each of whom has 10 observations
people = 100
obs = 10
# Generate person-level variation
sub_noise = data.frame(id = 1:people, rand_int = rnorm(people,0,60))
# And within person noise
resids = rnorm(people*obs, 0, 20)
id = rep(1:people,obs)
thedata = data.frame(id)
thedata = merge(sub_noise, thedata)
thedata$x = rep(1:obs,people)
thedata$y = 23*thedata$x + 20 + thedata$rand_int + resids
thed...