Displaying 20 results from an estimated 28 matches for "lme2".
Did you mean:
lme
2010 Sep 16
1
Help for an absolutely r-noob
...ot;, "\\1.\\2", dat$amp))
##### (2) Explorative plots #####
library(lattice)
xyplot(resp ~ amp|id, dat, type=c("g","p","smooth"))
##### (3) MIXED-EFFECTS REGRESSION MODELS #####
library(nlme)
lme1 <- lme(resp ~ amp, dat, ~1|id, method="ML")
lme2 <- lme(resp ~ amp + I(amp^2), dat, ~1|id, method="ML")
lme2a <- lme(resp ~ amp + I(amp^2), dat, ~amp|id, method="ML")
lme3 <- lme(resp ~ amp + I(amp^2) + I(amp^3), dat, ~1|id, method="ML")
lme5 <- lme(resp ~ factor(amp), dat, ~1|id, method="ML"...
2001 Dec 23
1
aov for mixed model (fixed and random)?
...wice.
8.0,9.2, 11.3,10.6, 9.8,11.9,
4.0,6.9, 9.8,10.1, 11.7,12.6,
10.3,9.4, 11.4,10.5, 7.9,8.1,
9.3,10.6, 13.0,11.7, 8.3,7.9,
9.5,9.8, 12.2,12.3, 8.6,10.5)
aov1 <- aov(h1~task*subj)
anova(aov1) # See note below.
lme1 <- lme(h1~task,random=~1|subj)
lme2 <- lme(h1~task,random=~1|subj/task)
anova(lme1,lme2) # for interaction
anova(lme2) # for effect of task
-------
The anova gives very close to the correct F values for subj
(1.68, according to Hays) and for the interaction (7.19), but the
wrong F values for task, because it treats task as a rand...
2005 Jul 18
1
Nested ANOVA with a random nested factor (how to use the lme function?)
...on 4 112366 28092 1.2742 0.2962
Location:Transect 5 121690 24338 1.1039 0.3736
Residuals 40 881875 22047
I have tried the following lme function to specify that Site is random:
> lme1 <- lme(sp~Location, random=~1|Site, data=mavric)
> lme2 <- lme(sp~Location, random=~1|Location/Site, data=mavric)
> anova(lme1)
numDF denDF F-value p-value
(Intercept) 1 40 3.418077 0.0719
Location 4 5 1.152505 0.4294
This gives me the correct F-value for Location from
MSLocation/MSLocation:Transect, but...
2007 Nov 01
2
F distribution from lme()?
...5.216
23 3 27.50000 42.336
5 3 28.16205 51.264
24 3 34.69391 48.960
45 3 28.79778 46.368
368 3 26.18006 45.792
29 3 29.75208 45.216
78 3 25.28393 43.200
44 3 23.32825 44.640
# lme-model with "individual" as random factor
> incub.lme2<-lme(egg.temp~kjday+treat,random=~1|ind,data=incub.df)
Fixed effects: egg.temp ~ kjday + treat
Value Std.Error DF t-value p-value
(Intercept) 24.937897 6.662475 11 3.743038 0.0032
kjday 0.108143 0.152540 7 0.708945 0.5013
treat3 -1.506605 0.485336 7 -3.104...
2007 Jun 28
2
aov and lme differ with interaction in oats example of MASS?
...or(B/V), data = oats, qr = T)
summary(oats.aov)
# now lme
oats.lme<-lme(Y ~ N + V, random = ~1 | B/V, data = oats)
anova(oats.lme, type="m") # Ok!
# aov:Y ~ N * V + Error(B/V)
oats.aov2 <- aov(Y ~ N * V + Error(B/V), data = oats, qr = T)
summary(oats.aov2)
# now lme - my trial!
oats.lme2<-lme(Y ~ N * V, random = ~1 | B/V, data = oats)
anova(oats.lme2, type="m")
# differences!!! (except of interaction term)
My questions:
1) Is there a possibility to reproduce the result of aov with interaction using lme?
2) If not, which result of the above is the correct one for the o...
2003 Jun 17
1
lme() vs aov(y ~ A*B + Error(aa %in% A + bb %in% B)) [repost]
I've posted the following to R-help on May 15.
It has reproducible R code for real data -- and a real
(academic, i.e unpaid) consultion background.
I'd be glad for some insight here, mainly not for myself.
In the mean time, we've learned that it is to be expected for
anova(*, "marginal") to be contrast dependent, but still are
glad for advice if you have experience.
Thank
2011 Feb 03
0
Need advises on mixed-effect model ( a concrete example)
...###########################
# first fit a model with single fixed effects of condition and groups
result.lme1<-lme(RT~CONDITION+GROUP,data= meandata,random=~1|SUBJECT,
method="ML")
plot(effet.lme) # residuals are goodlooking
#then I try to add an interaction term in the model
result.lme2<-lme(RT~CONDITION*GROUP,data= meandata,random=~1|SUBJECT,
method="ML")
#I then compare both models
anova(result.lme1,result.lme2)
#gives
Model df AIC BIC logLik Test L.Ratio p-value
effet.lme 1 8 3696.878 3726.822 -1840.439
effet.lme2 2 14 3705.8...
2009 Apr 01
3
How to prevent inclusion of intercept in lme with interaction
...ct)
grd$pred1 = predict(grd.lme1,level=0)
summary(grd.lme1)
# How go force intercept = 0 ???
grd.lme0 = lme(newbone~t*treat-1,data=grd,random=~1|subject)
grd$pred0 = predict(grd.lme0,level=0)
summary(grd.lme0)
# Gives true,
all.equal(grd$pred1,grd$pred0)
# Everything as expected without treat
grd.lme2 = lme(newbone~t,data=grd,random=~1|subject)
grd$pred2 = predict(grd.lme2,level=0)
summary(grd.lme2)
# Forced intercept = 0
grd.lme3 = lme(newbone~t-1,data=grd,random=~1|subject)
grd$pred3 = predict(grd.lme3,level=0)
summary(grd.lme3)
# As expected: not equal
all.equal(grd$pred2,grd$pred3)
#------...
2008 Oct 15
2
Network meta-analysis, varConstPower in nlme
...frame(trt), lumley1)
lumley1 <- transform(lumley1, trtpair = paste(Active, Control))
sigma <- rep(sqrt(.5), nrow=lumley1)
library(nlme)
lme1 <- lme(Y1 ~ trt.B + trt.C + trt.D + trt.E, random = ~ 1 | trtpair,
data=lumley1, var = varConstPower(form=~sigma, fixed=list(power=1)))
summary(lme1)
lme2 <- lme(Y2 ~ trt.B + trt.C + trt.D + trt.E, random = ~ 1 | trtpair,
data=lumley1), var = varConstPower(form=~sigma, fixed=list(power=1)))
summary(lme2)
2003 Apr 08
2
Basic LME
...ter way to analyse this data compared to the AOV model, since Genotype is a random factor. However, I obtain the same parameter estimate and p value for Age. Please can someone tell me why?
2: When using LME, when I am after a p value for the covariate Age, is it better to do the following;
Model.lme2 <- lme (Weight~Age, random=~ 1|Genotype, method="ML")
Model.lme3 <- lme (Weight~1, random=~ 1|Genotype, method="ML")
Anova(Model.lme2, Model.lme3)
Giving likelihood ratio=0.102, with p=0.749, which is slightly different to the p values of 0.758 above.
Thanks for your at...
2004 Jun 11
2
lme newbie question
...when I want to investigate the
influence of the age.group, and the two conditions on the rt:
my.lme <- lme(rt ~ age.group + angles * hands, data = my.data, random =
~ 1 |subject)
then I think I would have to compare the model above with a more
elaborated one, including more interactions:
my.lme2 <- lme(rt ~ age.group * angles * hands, data = my.data, random
= ~ 1 |subject)
and comparing them by performing a likelhood-ratio test, yes?
I think, if I would like to generalize the influence of the experimental
conditions on the rt I should define angles and hands as a random
effect, yes?...
2005 Sep 19
1
How to mimic pdMat of lme under lmer?
...2,2,2,2,2))
R <- factor(c(1,1,2,2,3,3,1,1,2,2,3,3))
s <-
c(51.43,51.28,50.93,50.75,50.47,50.83,51.91,52.43,52.26,52.33,51.58,51.23)
DS <- data.frame(F,R,s)
DS$F <- as.factor(DS$F)
DS$R <- as.factor(DS$R)
library(nlme)
lme1 <- lme(data = DS,s ~ F,random = list(R = pdLogChol(~F)))
lme2 <- lme(data = DS,s ~ F,random = list(R = pdDiag(~F)))
summary(lme1)
summary(lme2)
library(lme4)
lmer1 <- lmer(data = DS,s ~ F + (F|R))
lmer2 <- lmer(data = DS,s ~ F + (1|R) + (1|F))
summary(lmer1)
summary(lmer2)
confidentiality notice:
The information contained in this e-mail is confid...
2007 May 24
4
Function to Sort and test AIC for mixed model lme?
Hi List
I'm running a series of mixed models using lme, and I wonder if there
is a way to sort them by AIC prior to testing using anova
(lme1,lme2,lme3,....lme7) other than by hand.
My current output looks like this.
anova
(lme.T97NULL.ml,lme.T97FULL.ml,lme.T97NOINT.ml,lme.T972way.ml,lme.T97fc.
ml, lme.T97ns.ml, lme.T97min.ml)
Model df AIC BIC logLik Test
L.Ratio p-value
lme.T97NULL.ml 1 3 624.3...
2004 Jul 16
1
Fixed and random factors in aov()
Hi,
I'm confused about how to specify random and fixed factors in an aov()
term. I tried to reproduce a textbook example: One fixed factor (Game, 4
levels) and one random factor (Store, 12 levels), response is Points.
The random factor Store is nested in Game. I tried
> str(kh.df)
`data.frame': 48 obs. of 4 variables:
$ Subj : Factor w/ 48 levels
2007 Oct 31
0
Problems with generating F-distr from lme()
...5.216
23 3 27.50000 42.336
5 3 28.16205 51.264
24 3 34.69391 48.960
45 3 28.79778 46.368
368 3 26.18006 45.792
29 3 29.75208 45.216
78 3 25.28393 43.200
44 3 23.32825 44.640
# lme-model with "individual" as random factor
> incub.lme2<-lme(egg.temp~kjday+treat,random=~1|ind,data=incub.df)
Fixed effects: egg.temp ~ kjday + treat
Value Std.Error DF t-value p-value
(Intercept) 24.937897 6.662475 11 3.743038 0.0032
kjday 0.108143 0.152540 7 0.708945 0.5013
treat3 -1.506605 0.485336 7 -3.10...
2011 Oct 04
1
Question about linear mixed effects model (nlme)
Hi,
I applied a linear mixed effect model in my data using the nlme package.
lme2<-lme(distance~temperature*condition, random=~+1|trial, data) and then
anova.
I want to ask if it is posible to get the least squares means for the
interaction effect and the corresponding 95%ci. And then plot this values.
Thank you
Panagiotis
--
View this message in context: http://r.789695....
2003 Sep 30
0
lme vs. aov
...1 4 0.139445 0.7278
time 2 8 0.012365 0.9877
treat:sex 1 4 0.014175 0.9110
treat:time 2 8 0.120538 0.8880
sex:time 2 8 0.304878 0.7454
treat:sex:time 2 8 0.391012 0.6886
#### using y as dependable variable
xx.lme2<-lme(y~treat*sex*time,random=~1|subject,xx)
xx.aov2<-aov(y~treat*sex*time+Error(subject),xx)
summary(xx.aov2)
Error: subject
Df Sum Sq Mean Sq F value Pr(>F)
treat 1 0.147376 0.147376 2.0665 0.2239
sex 1 0.000474 0.000474 0.0067 0.9389
treat:sex 1 0.006154 0....
2003 Oct 02
0
lme vs. aov with Error term
...1 4 0.139445 0.7278
time 2 8 0.012365 0.9877
treat:sex 1 4 0.014175 0.9110
treat:time 2 8 0.120538 0.8880
sex:time 2 8 0.304878 0.7454
treat:sex:time 2 8 0.391012 0.6886
#### using y as dependable variable
xx.lme2<-lme(y~treat*sex*time,random=~1|subject,xx)
xx.aov2<-aov(y~treat*sex*time+Error(subject),xx)
summary(xx.aov2)
Error: subject
Df Sum Sq Mean Sq F value Pr(>F)
treat 1 0.147376 0.147376 2.0665 0.2239
sex 1 0.000474 0.000474 0.0067 0.9389
treat:sex 1 0.006154 0.0...
2003 Oct 01
0
lme vs. aov with Error term again
...1 4 0.139445 0.7278
time 2 8 0.012365 0.9877
treat:sex 1 4 0.014175 0.9110
treat:time 2 8 0.120538 0.8880
sex:time 2 8 0.304878 0.7454
treat:sex:time 2 8 0.391012 0.6886
#### using y as dependable variable
xx.lme2<-lme(y~treat*sex*time,random=~1|subject,xx)
xx.aov2<-aov(y~treat*sex*time+Error(subject),xx)
summary(xx.aov2)
Error: subject
Df Sum Sq Mean Sq F value Pr(>F)
treat 1 0.147376 0.147376 2.0665 0.2239
sex 1 0.000474 0.000474 0.0067 0.9389
treat:sex 1 0.006154 0.0...
2012 Sep 14
1
linear mixed-effects models with two random variables?
...ghness +
DivBoulders , data= myData ) # random intercept and slope
#Error in getGroups.data.frame(dataMix, groups) :
# Invalid formula for groups
# if I only use one random variable I have:
#Error in chol.default((value + t(value))/2) :
#the leading minor of order 2 is not positive definite
lme2 <- lme( Biomass ~ fReserve , random = ~1 | Roughness +
DivBoulders ,data=myData) #random
intercept
#Error in getGroups.data.frame(dataMix, groups) :
# Invalid formula for groups
# if I only use one random variable my result is fine!
lme3 <- lme (Biomass ~ fReserve , random= ~ Rough...