Hi Adam,
 
I have several questions/clarifications and some comments about your
design: (1) Isn't geography confounded with treatment? (2) Subplot is
your experimental unit for each treatment level.  Are there different
kinds of fruits available in a subplot for each count period, or are
they all the same kind? If the former, were all kinds always available?
Your statement that there are 14 records for each individual fruit seems
to suggest you are referring to repeated observations on the same fruit
type/kind?   If only one fruit type, the number of fruits eaten or
remaining in each subplot for each count period is your basic response
variable; but there would actually be a cross-classified response,if
there was more than one fruit type in each subplot (i.e. eat/not eat X
fruit type).  (3) since the same plots & subplots were monitored
repeatedly, it certainly seems to be a repeated measures design.  In the
Big R book, Crawley collapses time for a binary response repeated
measures design, but it seems to be that he is assuming independence of
repeated observations by doing that (p. 604).  
 
Carl von Ende
 
 

>>> <r-sig-mixed-models-request@r-project.org> 7/28/2010 5:07 PM >>>
Send R-sig-mixed-models mailing list submissions to
r-sig-mixed-models@r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
or, via email, send a message with subject or body 'help' to
r-sig-mixed-models-request@r-project.org

You can reach the person managing the list at
r-sig-mixed-models-owner@r-project.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-sig-mixed-models digest..."


Today's Topics:

   1. Error in UseMethod("ranef") (Gustavo Betini)
   2. variance-covariance structure of random effects in glmer
      (Tanja Srebotnjak)
   3. ramps::corStruct formats: compatible in nlme? (Tyler Dean
Rudolph)
   4. Re: p-values with lmer (Andrew Kosydar)
   5. Re: Error in UseMethod("ranef") (Luca Borger)
   6. Re: Error in UseMethod("ranef") (Gustavo Betini)
   7. Difficulty with GLMM specification in lme4 (Adam Smith)


----------------------------------------------------------------------

Message: 1
Date: Wed, 28 Jul 2010 11:50:26 -0400
From: Gustavo Betini <betinig@uoguelph.ca>
To: r-sig-mixed-models@r-project.org
Subject: [R-sig-ME] Error in UseMethod("ranef")
Message-ID: <4C5051C2.7050102@uoguelph.ca>
Content-Type: text/plain

Hi, all,

yesterday I ran a GLMM with the glmer function from the lme4 package, 
and extracted the modes of the random effects using ranef(model). This

morning I tried to do the same and got the following error:

Error in UseMethod("ranef") :
   no applicable method for 'ranef' applied to an object of class
"mer"

I tried the example from the R documentation,

fm3 <- lmer(diameter ~ (1|plate) + (1|sample), Penicillin)
ranef(fm1)

and got the same error. It seems that I am missing something. Any
clue?

Thanks,

Gustavo S. Betini



[[alternative HTML version deleted]]



------------------------------

Message: 2
Date: Mon, 26 Jul 2010 12:15:16 -0700
From: Tanja Srebotnjak <Tanja.Srebotnjak@ecologic-institute.us>
To: r-sig-mixed-models@r-project.org
Subject: [R-sig-ME] variance-covariance structure of random effects in
glmer
Message-ID:
<AANLkTin_LxDtJws+-tkkhC_tAzD4UYoTSca=u78cvwWg@mail.gmail.com>
Content-Type: text/plain

Hello list members,

I know I should study the documentation of lme4 but I think you might
be
able to answer my question in a blink: what is the default
variance-covariance structure used in glmer in a logistic model with
logit
link and family binomial? And can it be changed?

Many thanks in advance!
Tanja

[[alternative HTML version deleted]]



------------------------------

Message: 3
Date: Mon, 26 Jul 2010 18:49:22 -0400
From: Tyler Dean Rudolph <tylerdeanrudolph@gmail.com>
To: r-sig-mixed-models@r-project.org
Subject: [R-sig-ME] ramps::corStruct formats: compatible in nlme?
Message-ID:
<AANLkTinFFfHsQAbi3F_jmjmH4LCZU+RZdU1GE1TWqRoD@mail.gmail.com>
Content-Type: text/plain

Are the spatial correlation structures constructed in the ramps
package
(e.g. corRMatern) exclusively compatible with georamps or is there also
a
way of using them in nlme or is that just wishful thinking?  I would
have
thought it possible since they are apparently the same class
(corStruct),
but based on the result of this test (using spatial data from the ruf
package) I don't suppose the two are compatible....

library(nlme)
library(ruf)
data(d412)

d412$group=1

# Shuts down R in a heartbeat!
test=lme(ruf ~ CWED + IJI + NP + MSI, random=~1 | group,
correlation=corRMatern(form=~x+y, metric="euclidean"), data=d412)

Tyler

[[alternative HTML version deleted]]



------------------------------

Message: 4
Date: Wed, 28 Jul 2010 08:34:03 -0400
From: Andrew Kosydar <drewdogy@uw.edu>
To: Christoph.Scherber@agr.uni-goettingen.de
Cc: r-sig-mixed-models@r-project.org, doris gomez <dodogomez@yahoo.fr>
Subject: Re: [R-sig-ME] p-values with lmer
Message-ID:
<AANLkTinB7oYkC5guwAYS4s0CqngmRT45vu7-OWx6PECa@mail.gmail.com>
Content-Type: text/plain

Dear Dorris,

You might also want to consider using multimodel inference techniques
as
outlined by Burnham and Anderson.  In my opinion, this technique is
superior
to the step-wise model selection approach.  This will also provide an
answer
to your question about p-values and interpretation.

Cheers!

Andrew










On Mon, Jul 19, 2010 at 5:32 PM, Christoph Scherber <
Christoph.Scherber@agr.uni-goettingen.de> wrote:

> Dear Doris,
>
> I assume you performed a likelihood ratio test on the two models?
>
> The model containing X1 has the lower AIC, so it is actually
pointless to
> perform a likelihood ratio test on that model and a model containing
both
> X1 and X2.
>
> Rather, to assess the significanced of X1, you should compare the
model to
> a null model (containing the intercept only).
>
> The algorithm is like this:
>
> - Write down your minimal adequate model
> - Write down the corresponding null model
> - Perform likelihood ratio tests, starting with the null model and
adding
> terms one at a time until you arrive at the minimal adequate model.
>
> Example:
>
> - minimal adequate model contains X1+X2+X3
> - Null model is ~1
> - Now do LRT́s with:
>
> ~1
> ~1+X1
> ~1+X1+X2
> ~1+X1+X2+X3
>
> And be sure to use;
> (1) QAIC in case of overdispersion
> (2) AICc in case of small sample sizes
>
> All the best
> Christoph
>
>
>
>
>
>
>
>
>
> > Dear lmer users,
> >
> > I compute several models with lmer (poisson distribution,
correction for
> > overdispersion).
> >
> > I run several models with the same random effect and different
structures
> > for
> > fixed effect (a full model and different models with only some of
the
> > factors of
> > the full model).
> >
> > I select the model with the minimal AIC. In fact, two models are
within 2
> > AIC
> > units:
> > - a model (with lowest AIC) with one factor, X1.
> > - another model (at 0.8 of the first) with two factors, X1 and X2.
> >
> > Looking at the p-values, X1 is significant in both models while X2
is not
> > significant, despite the low AIC associated to the model. How to
> interpret
> > the
> > apparent contradiction between the non-significant p-value and the
low
> > AIC?
> >
> >
> >>From an old message on the list, I can see that p-values  are not
good.
> > But the bayesian approach mcmcsample does not run either with
lmer.
> >
> > How to get the p-values associated with the fixed effects?
> > Thank you for your help
> > Doris Gomez
> >
> >
> >
> >       [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-mixed-models@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> >
>
> _______________________________________________
> R-sig-mixed-models@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

[[alternative HTML version deleted]]



------------------------------

Message: 5
Date: Wed, 28 Jul 2010 15:00:00 -0400
From: "Luca Borger" <lborger@uoguelph.ca>
To: "Gustavo Betini" <betinig@uoguelph.ca>,
<r-sig-mixed-models@r-project.org>
Subject: Re: [R-sig-ME] Error in UseMethod("ranef")
Message-ID: <4A01E93768BC420D95EF28FA80AAA8C5@lborger>
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
reply-type=original

Hello,

are you using updated versions for lme4, Matrix, R? It works on my
machine 
(Windows, see below):

(gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 |
herd),
+               family = binomial, data = cbpp))

> ranef(gm1)
$herd
   (Intercept)
1   0.59002543
2  -0.29889417
3   0.40626540
4   0.03928257
5  -0.19001102
6  -0.40026000
7   0.88940374
8   0.59937372
9  -0.23764977
10 -0.54092635
11 -0.08462816
12 -0.06481190
13 -0.68991231
14  0.97071999
15 -0.53046901

>


> fm3 <- lmer(diameter ~ (1|plate) + (1|sample), Penicillin)
> ranef(fm3)
$plate
  (Intercept)
a  0.80454705
b  0.80454705
c  0.18167191
d  0.33739070
e  0.02595313
f -0.44120322
g -1.37551593
h  0.80454705
i -0.75264079
j -0.75264079
k  0.96026583
l  0.49310948
m  1.42742219
n  0.49310948
o  0.96026583
p  0.02595313
q -0.28548444
r -0.28548444
s -1.37551593
t  0.96026583
u -0.90835957
v -0.28548444
w -0.59692201
x -1.21979714

$sample
  (Intercept)
A  2.18724529
B -1.01056270
C  1.93806545
D -0.09690327
E -0.01384332
F -3.00400144

>


> sessionInfo()
R version 2.11.1 (2010-05-31)
i386-pc-mingw32

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United 
Kingdom.1252    LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] lme4_0.999375-34   Matrix_0.999375-42 lattice_0.18-8

loaded via a namespace (and not attached):
[1] grid_2.11.1   nlme_3.1-96   stats4_2.11.1 tools_2.11.1
>


HTH

Cheers,

Luca


----- Original Message ----- 
From: "Gustavo Betini" <betinig@uoguelph.ca>
To: <r-sig-mixed-models@r-project.org>
Sent: Wednesday, July 28, 2010 11:50 AM
Subject: [R-sig-ME] Error in UseMethod("ranef")


> Hi, all,
>
> yesterday I ran a GLMM with the glmer function from the lme4
package,
> and extracted the modes of the random effects using ranef(model).
This
> morning I tried to do the same and got the following error:
>
> Error in UseMethod("ranef") :
>   no applicable method for 'ranef' applied to an object of class
"mer"
>
> I tried the example from the R documentation,
>
> fm3 <- lmer(diameter ~ (1|plate) + (1|sample), Penicillin)
> ranef(fm1)
>
> and got the same error. It seems that I am missing something. Any
clue?
>
> Thanks,
>
> Gustavo S. Betini
>
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>



------------------------------

Message: 6
Date: Wed, 28 Jul 2010 15:33:20 -0400
From: Gustavo Betini <betinig@uoguelph.ca>
To: r-sig-mixed-models@r-project.org
Subject: Re: [R-sig-ME] Error in UseMethod("ranef")
Message-ID: <4C508600.5050609@uoguelph.ca>
Content-Type: text/plain

Hi, Luca,

yes, I updated R and lme4 yesterday. I just re-installed R and ranef()

is working again.
I should say that I am using a MacBook Pro with OS X 10.6.4.

thanks,

Gustavo


On 10-07-28 3:00 PM, Luca Borger wrote:
> Hello,
>
> are you using updated versions for lme4, Matrix, R? It works on my 
> machine (Windows, see below):
>
> (gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 |
herd),
> +               family = binomial, data = cbpp))
>
>> ranef(gm1)
> $herd
>   (Intercept)
> 1   0.59002543
> 2  -0.29889417
> 3   0.40626540
> 4   0.03928257
> 5  -0.19001102
> 6  -0.40026000
> 7   0.88940374
> 8   0.59937372
> 9  -0.23764977
> 10 -0.54092635
> 11 -0.08462816
> 12 -0.06481190
> 13 -0.68991231
> 14  0.97071999
> 15 -0.53046901
>
>>
>
>
>> fm3 <- lmer(diameter ~ (1|plate) + (1|sample), Penicillin)
>> ranef(fm3)
> $plate
>  (Intercept)
> a  0.80454705
> b  0.80454705
> c  0.18167191
> d  0.33739070
> e  0.02595313
> f -0.44120322
> g -1.37551593
> h  0.80454705
> i -0.75264079
> j -0.75264079
> k  0.96026583
> l  0.49310948
> m  1.42742219
> n  0.49310948
> o  0.96026583
> p  0.02595313
> q -0.28548444
> r -0.28548444
> s -1.37551593
> t  0.96026583
> u -0.90835957
> v -0.28548444
> w -0.59692201
> x -1.21979714
>
> $sample
>  (Intercept)
> A  2.18724529
> B -1.01056270
> C  1.93806545
> D -0.09690327
> E -0.01384332
> F -3.00400144
>
>>
>
>
>> sessionInfo()
> R version 2.11.1 (2010-05-31)
> i386-pc-mingw32
>
> locale:
> [1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United 
> Kingdom.1252    LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
> [5] LC_TIME=English_United Kingdom.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] lme4_0.999375-34   Matrix_0.999375-42 lattice_0.18-8
>
> loaded via a namespace (and not attached):
> [1] grid_2.11.1   nlme_3.1-96   stats4_2.11.1 tools_2.11.1
>>
>
>
> HTH
>
> Cheers,
>
> Luca
>
>
> ----- Original Message ----- From: "Gustavo Betini"
<betinig@uoguelph.ca>
> To: <r-sig-mixed-models@r-project.org>
> Sent: Wednesday, July 28, 2010 11:50 AM
> Subject: [R-sig-ME] Error in UseMethod("ranef")
>
>
>> Hi, all,
>>
>> yesterday I ran a GLMM with the glmer function from the lme4
package,
>> and extracted the modes of the random effects using ranef(model).
This
>> morning I tried to do the same and got the following error:
>>
>> Error in UseMethod("ranef") :
>>   no applicable method for 'ranef' applied to an object of class
"mer"
>>
>> I tried the example from the R documentation,
>>
>> fm3 <- lmer(diameter ~ (1|plate) + (1|sample), Penicillin)
>> ranef(fm1)
>>
>> and got the same error. It seems that I am missing something. Any
clue?
>>
>> Thanks,
>>
>> Gustavo S. Betini
>>
>>
>>
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-mixed-models@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>
>
> _______________________________________________
> R-sig-mixed-models@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

[[alternative HTML version deleted]]



------------------------------

Message: 7
Date: Wed, 28 Jul 2010 17:04:55 -0400
From: Adam Smith <raptorbio@hotmail.com>
To: <r-sig-mixed-models@r-project.org>
Subject: [R-sig-ME] Difficulty with GLMM specification in lme4
Message-ID: <BAY127-W12F59BE6BA9126D63419D2A1A80@phx.gbl>
Content-Type: text/plain; charset="iso-8859-1"


Hello list,

I think I've exhausted my (limited) knowledge of GLMMs in attempting to
analyze a for a subset of my research.? I've been immersed in the R-help
archives and recent publications for the past two weeks, and I've
finally decided to solicit help from this distinguished list.? This is
my first post, and I've read the appropriate posting materials, but I
hope you'll forgive should I stray from those recommendations at any
point.

First, some background...

The objective: Examine the fixed effect of treatment (binary) and
geography (binary) on the consumption of fruits by avian frugivores over
14 count periods.? Specifically, I'd like to generate odds of
consumption for each count period, and determine whether the odds vary
between treatments or geographic locations (either as a consistent main
effect or via an interaction with count period).? I'm most concerned
with marginal effects (which I know GLMM is not giving me), but GEE
model selection strike me as even less fun...and the results from
similar GEE and GLMM models on similar datasets have given me comparable
qualitative results.

The design:? 17 plots, each comprising two subplots.? Treatment levels
(e.g., control or treatment) were assigned randomly to the subplots
within a plot.? 

The response:? On each subplot, I monitored the fate (consumed or not)
of fruits during 14 count periods.? The number of fruits initially
present and monitored on a given subplot varied (min = 71, max = 461,
total = 7572). 

At present, I am modeling consumption (yes or no) as a function of each
count period (this very general time specification is likely to be
appropriate), the treatment effect, and the geographic location of the
plots (north vs. south).? In the dataset "fruit", each individual fruit
(id) has up to 14 records, depending on when or if it was consumed.? For
the 7572 individuals, this results in 59779 records:? 

> str(fruit)
'data.frame':?? 59779 obs. of? 6 variables:
?$ id??????? : Factor w/ 7572 levels "1","2","3","4",..: 1 2 3 4 5 6 7
8 9 10 ...
?$ plot?? ?? : Factor w/ 17 levels "N-10","N-2","N-3",..: 1 1 1 1 1 1 1
1 1 1 ...
?$ trt?????? : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
?$ geog????? : Factor w/ 2 levels "0","1": 2 2 2 2 2 2 2 2 2 2 ...
?$ count???? : Factor w/ 14 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1
1 1 ...
?$ cons????? : int? 1 1 0 0 0 0 0 0 0 0 ...
?$ available : int? 260 260 260 260 260 260 260 260 260 260 ...

Is this dataset format unnecessary?? Can I not simply sum events in
each count period in each subplot, such that my response variable takes
the form of cbind(cons, available - cons), or does this violate the
binomial assumption that events are independent?

The answer to these questions would seem to dictate the appropriate
specification of the random effects.? If I leave the dataset as is, I'm
not sure what specification of the random effects is most appropriate.
Are there not three random effects that need to be modeled?? I recall
that when Judith Singer and John Willett (Applied Longitudinal Data
Analysis, 2003) set up data like this, they ignore the apparent repeated
measure on individuals...

The most relevant glmer model that I have tried using the original data
format is: 

m_orig <- glmer(cons ~ count + geog + trt + count:geog + count:trt? +
(1 | plot) + (1 | plot/trt) + (1 | id), data=fruit, family=binomial)

As I said, this model, and those dropping the (1 | id) term, churn for
hours; I've yet to see it converge (or do anything).

The alternative dataset actually converges quickly.? For example, after
creating a new dataset that sums consumption events (num_cons) within
each count time period (not shown):

m_alt <- glmer(cbind(num_cons, available-num_cons) ~ count + geog + trt
+ count:geog + count:trt? + (1 | plot) + (1 | plot/trt), data=fruit_alt,
family=binomial)

Which specification is more appropriate?? Am I way off base with this??
Since I'm interested in marginal effects, perhaps my objectives would be
better addressed with the GEE approach?

Any assistance is greatly appreciated.

Best,

Adam Smith
Ph.D. Candidate, Avian Ecology
Dept. Natural Resources Science
University of Rhode Island
     
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with
Hotmail.

ID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4


------------------------------

_______________________________________________
R-sig-mixed-models mailing list
R-sig-mixed-models@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models


End of R-sig-mixed-models Digest, Vol 43, Issue 41
**************************************************

	[[alternative HTML version deleted]]


