[R] A question on the library lme4

Bill.Venables@csiro.au Bill.Venables at csiro.au
Sun Apr 24 04:14:31 CEST 2005


Luis Fernando Chaves asks:

: -----Original Message-----
: From: r-help-bounces at stat.math.ethz.ch 
: [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Luis 
: Fernando Chaves
: Sent: Sunday, 24 April 2005 11:29 AM
: To: R-help at R-project.org
: Subject: [R] A question on the library lme4
: 
: 
: Hi,
: 
: I ran the following model using nlme:
: 
: model2 <- lme(log(malrat1) ~ I(year-1982), 
: random = ~1|Continent/Country, data=wbmal10)
: 
: I'm trying to run a Poisson GlMM to avoid the above 
: transformation but I 
: don't know how to specify the model using lmer in the lme4 library:
: 
: model3 <- lmer((malrat1) ~ I(year-1982) + ??, 
: data=wbmal10, family=poisson)

(I asked the same question of Doug Bates, as it happens.)

Try the following:

wbmal10 <- transform(wbmal10, Cont_Country = Continent:Country)
require(lme4)
model3 <- lmer(malrat1 ~ I(year - 1982) + (1|Continent)
		+ (1|Cont_Country), family = poisson, data = wbmal10)

: 
: How can I introduce a random factor of the form= ~1|Continent/Country?
: 
: Thanks;
: 
: -- 
: Luis Fernando Chaves
: 
: ______________________________________________
: R-help at stat.math.ethz.ch mailing list
: https://stat.ethz.ch/mailman/listinfo/r-help
: PLEASE do read the posting guide! 
: http://www.R-project.org/posting-guide.html
:




More information about the R-help mailing list