From: David Afshartous <dafshartous_at_med.miami.edu>

Date: Tue, 05 Feb 2008 16:34:42 -0500

R-help_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 05 Feb 2008 - 21:35:45 GMT

Date: Tue, 05 Feb 2008 16:34:42 -0500

All,

I've fit some models via lme() and now I'm trying to fit similar models with lmer() for some simulations I'm running.

The model below (fm1) has an intercept variance that depends on treatment group. How would one accomplish a similar stratification for the level-1 variance, i.e., the within-group or patient variance?

With lme() I was able to do this via:

update(fm1,

weights = varIdent(form = ~ 1 | treatment.ind) )

However, this does not work for lmer(). Is there any way around this?

Model and simulated data below.

Cheers,

David

fm1 = lmer (y ~ treatment.ind + ( 0 + placebo.ind | person1) + (0 + treatment.ind | person1), data = fake)

###################

Strat.mean.var.simple <- function (J, K){

# function to generate simple longit

time <- rep(seq(0,1, ,length=K), J) # K measurements person <- rep(1:(J/2), each = K) treatment <- rep(0:1, each = J/2) treatment.ind <- rep(0:1, each = (J/2)*K) person1 <- rep(1:J, ,each = K) placebo.ind.1 <- treatment.ind < 1 placebo.ind = ifelse( placebo.ind.1, 1, 0)}

#

mu.a.true.P = 4.8 mu.a.true.T = 8.8 sigma.a.true.P = 2.2 sigma.a.true.T = 4.2 sigma.y.true = 1.2

#

a.true.P = rnorm (J/2, mu.a.true.P, sigma.a.true.P) a.true.T = rnorm (J/2, mu.a.true.T, sigma.a.true.T)

#

y.P <- rnorm( (J/2)*K, a.true.P[person], sigma.y.true) y.T <- rnorm( (J/2)*K, a.true.T[person], sigma.y.true) y <- c(y.P, y.T) return ( data.frame (y, time, person1, treatment.ind, placebo.ind))

J = 10

K = 4

set.seed(500)

fake = Strat.mean.var.simple (J,K)

R-help_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 05 Feb 2008 - 21:35:45 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Wed 06 Feb 2008 - 09:30:12 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*