[R-sig-ME] Wald's test
John Fox
jfox at mcmaster.ca
Wed Dec 5 03:27:32 CET 2012
Dear Ben.
Anova.lme() in car does only chisquare tests, but Anova.lmer() also does F-tests using the KR df computed by the pbkrtest package only for models fit by lmer(). That package was also mentioned by Justin in his last posting.
Best,
John
On Tue, 04 Dec 2012 20:36:09 -0500
Ben Bolker <bbolker at gmail.com> wrote:
> It does appear however that (as Justin said in the first place) that
> car::Anova.lme does only chi-squared and not F tests (car 2.0-15). I
> haven't looked to see how hard it would be to extract the information
> from the lme object to get the relevant denominator df (and I don't know
> if there are theoretical complications ...)
> Even the two-model anova.lme doesn't do F tests, only likelihood
> ratio tests. Again, don't know whether this is an oversight or whether
> there's some reason *not* to provide the option. (In contrast
> anova.glm() *does* provide an F test, for testing nested models with
> estimated scale parameters.)
>
>
> On 12-12-04 08:19 PM, Justin Chase wrote:
> > Thanks Dr. Fox.
> >
> > I only just figured out today that there were specific help files like
> > ?anova.lme. I was trying to figure out the function using only ?anova,
> > which says very little.
> > That said, I did come across the package "pbkrtest" today and found that
> > it provides a nice approximate type II F test (the Kenward-Roger
> > approximation) for mixed effects models from lme4. I may wait for the
> > Halekoh and Højsgaard paper to come out in the Journal of Statistical
> > Software before I switch to this approach, but I would be interested to
> > see what others in the R community think about the package and the K-R f
> > test.
> >
> > Thanks again!
> >
> > Justin
> >
> > On Tue, Dec 4, 2012 at 8:32 PM, John Fox <jfox at mcmaster.ca
> > <mailto:jfox at mcmaster.ca>> wrote:
> >
> > Dear Justin,
> >
> > The documentation in ?anova.lme seems very clear to me -- what is
> > described for type="marginal" is what is often called type III
> > tests, though for these to be sensible in models with interactions,
> > careful attention has to be paid to contrast coding. The Anova()
> > function in the car package has methods for type II tests for models
> > fit by lme() in the nlme package and lmer() in the lme4 package.
> >
> > I hope this helps,
> > John
> >
> > ------------------------------------------------
> > John Fox
> > Sen. William McMaster Prof. of Social Statistics
> > Department of Sociology
> > McMaster University
> > Hamilton, Ontario, Canada
> > http://socserv.mcmaster.ca/jfox/
> >
> > On Tue, 4 Dec 2012 11:15:56 -0400
> > Justin Chase <justinwchase1 at gmail.com
> > <mailto:justinwchase1 at gmail.com>> wrote:
> > > Thanks Dr. Bolker! I have one issue though: I was able to
> > generate F tests
> > > for my lme models using your suggestion anova(fm1,type="marginal") ,
> > > however, it is my understanding that "marginal" typically refers
> > to Type 3
> > > sums-of-squares, which is discouraged. I'm looking to generate
> > Type 2 tests
> > > (i.e., "conditional"). The help file for anova() does not explain
> > what the
> > > word "marginal" means in the context of the function, thus I've
> > cc'd John
> > > Fox, who may be able to confirm whether or not this is Type II SS.
> > >
> > > Thanks!
> > >
> > > Justin
> > >
> > > On Tue, Dec 4, 2012 at 10:12 AM, Ben Bolker <bbolker at gmail.com
> > <mailto:bbolker at gmail.com>> wrote:
> > >
> > > >
> > > > [I'm taking the liberty of cc'ing r-sig-mixed-models ... I strongly
> > > > prefer *not* to answer mixed models questions offline, for a
> > variety of
> > > > reasons.]
> > > >
> > > > On 12-12-03 02:12 PM, Justin Chase wrote:
> > > > > Hi there Dr. Bolker.
> > > > >
> > > > > I have a question regarding both your 2008 paper in TREE and your
> > > > > response to Helios de Rosario's mixed model question on the
> > > > > R-sig-mixed-models mailing list. I am analyzing count data
> > (transformed
> > > > > for normality) from a slightly unbalanced split-plot lab
> > experiment. I
> > > > > have two fixed factors, one whole-plot and one sub-plot, with
> > "plot" as
> > > > > random factor. the model looks like this:
> > > > >
> > > > > *y = µ + A_i + B_j + A*B_ij + C_k (B_i ) + A*C(B_i )_jk +
> > e_l(ijk) *
> > > > >
> > > > > I have been using the nlme package in R to test the
> > significance of
> > > > > fixed factors and their interaction on my univariate data,
> > following
> > > > > chapter 19 in The R Book (Crawley 2007).
> > > >
> > > > I don't actually have Crawley's book (although I probably
> > should, if
> > > > only to find out what he's telling people to do).
> > > >
> > > > > However, I'm not interested in
> > > > > analyzing coefficients of individual effects (treatment
> > levels) like
> > > > > Bates does, but just want a significance test for whole
> > factors. Because
> > > > > I don't want to prioritize either fixed factor, I prefer to
> > generate
> > > > > type II SS estimates. Like Helios de Rosario, I used the Anova
> > function
> > > > > in the car package to generate type II anova tables with
> > Wald's Chi
> > > > > Square test and P values (because the F test is not available
> > for this
> > > > > type of model). The results seem very reasonable and are fairly
> > > > > consistent with some least squares tests I've done on the same
> > data
> > > > > using aov (reordering terms to get "type II" results). I've
> > read your
> > > > > response to Helios's inquiry but unfortunately it was a bit
> > over my
> > > > > head. According to your paper in TREE, my data should be
> > analyzed with
> > > > > REML and F tests, but only Wald's X2 is available in R. Do you
> > think I'm
> > > > > on the right track or should I just forget about using REML
> > and analyze
> > > > > with aov on least squares fits (laboriously rearranging model
> > terms to
> > > > > get type II tests)?
> > > >
> > > > Hmm. Obviously I don't have your exact model, but I'm trying to
> > > > figure out what's wrong with, for example,
> > > >
> > > > library(nlme)
> > > > fm1 <- lme(distance ~ age, data = Orthodont) # random is ~ age
> > > > anova(fm1,type="marginal")
> > > >
> > > > ## numDF denDF F-value p-value
> > > > ## (Intercept) 1 80 467.4406 <.0001
> > > > ## age 1 80 85.8464 <.0001
> > > >
> > > > ? see anova.lme
> > > >
> > > > Some of the complexity of the 2008 paper is due to the fact
> > > > that GLMMs are more challenging in several respects than LMMs.
> > > >
> > > > > Also, should I be testing for overdispersion when using the
> > Wald test,
> > > > > even though I'm just modelling Gaussian data with lme?
> > > >
> > > > No. The Gaussian family has an adjustable scale parameter (i.e.,
> > > > the variance is estimated from the data, rather than [as in the
> > > > binomial or Poisson families] fixed at a theoretical value)
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > *Justin W. Chase*
> > > MSc Candidate
> > > Canadian Rivers Institute
> > > University of New Brunswick
> > > 506-452-7474 <tel:506-452-7474> (home*)
> > > 506-453-4845 <tel:506-453-4845> (office)
> > > justinwchase1 at gmail.com <mailto:justinwchase1 at gmail.com>
> > > LinkedIn Profile <http://www.linkedin.com/in/justinwchase>
> > >
> > > [[alternative HTML version deleted]]
> > >
> >
> >
> >
> >
> >
> > --
> > *Justin W. Chase*
> > MSc Candidate
> > Canadian Rivers Institute
> > University of New Brunswick
> > 506-452-7474(home*)
> > 506-453-4845(office)
> > justinwchase1 at gmail.com <mailto:justinwchase1 at gmail.com>
> > LinkedIn Profile <http://www.linkedin.com/in/justinwchase>
> >
>
More information about the R-sig-mixed-models
mailing list