[R-sig-ME] R-sig-mixed-models Digest, Vol 50, Issue 38

Ursa Reja ursa.reja at gmail.com
Sun Feb 20 19:06:10 CET 2011



r-sig-mixed-models-request at r-project.org wrote:

>Send R-sig-mixed-models mailing list submissions to
>	r-sig-mixed-models at 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 at r-project.org
>
>You can reach the person managing the list at
>	r-sig-mixed-models-owner at 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. Re: Missing data in R... (romunov)
>   2. Question about the optimal design of an experiment for	ME
>      models (Jordan Mayor)
>   3. Interpretation of lmer output in R (Julia Sommerfeld)
>
>
>----------------------------------------------------------------------
>
>Message: 1
>Date: Fri, 18 Feb 2011 23:41:49 +0100
>From: romunov <romunov at gmail.com>
>To: Ben Bolker <bbolker at gmail.com>
>Cc: "r-sig-mixed-models at r-project.org"
>	<r-sig-mixed-models at r-project.org>
>Subject: Re: [R-sig-ME] Missing data in R...
>Message-ID:
>	<AANLkTinDuba4nXt3r0d-BTzsYTxXbwJHrFGchgGZvhe5 at mail.gmail.com>
>Content-Type: text/plain
>
>Or you could try
>www.stackoverflow.com<http://stackoverflow.com/questions/tagged/r>.
>Quite programming oriented site with plenty of knowledgeable people around
>to help out.
>
>Cheers,
>Roman
>
>
>
>On Fri, Feb 18, 2011 at 5:36 PM, Ben Bolker <bbolker at gmail.com> wrote:
>
>> On 11-02-18 11:32 AM, Jeffrey Harring wrote:
>> > I am reading in data in the "long" format into R to use in nlme ( ).
>> > There is some missing data that is denoted by a period "."
>> > I would like to assign these .'s the missing data value NA. I have been
>> > unable to locate code on the web that might perform this function.
>> >
>> > This is what I have thus far:   dat1[dat1$y == ".", "y"] <- NA
>> >
>> > where the data are assigned to data frame dat1 and the missing data is
>> > in a variable called y.
>> >
>> > If anyone has a suggestion I am all ears.
>> >
>> > Thanks,
>> > Jeff
>> >
>> >
>>
>>   see the 'na.strings' argument in ?read.table (also applies to read.csv)
>>  the problem is that having the '.' in there in the first place will
>> make your numeric variables turn into factors -- you can deal with this via
>>
>> dat1$y <- as.numeric(as.character(dat1$y))
>>
>> which will make anything that can't be interpreted as numeric into an NA
>> (and issue a warning) but it is easier and clearer to specify na.strings
>> in the first place.
>>
>>  For what it's worth, you might ask these kinds of questions on the
>> general R-help list -- they are not specific to mixed models.  (Make
>> sure to read the Posting Guide first ...)
>>
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>
>
>
>
>-- 
>In God we trust, all others bring data.
>
>	[[alternative HTML version deleted]]
>
>
>
>------------------------------
>
>Message: 2
>Date: Fri, 18 Feb 2011 18:15:37 -0500
>From: Jordan Mayor <clavulina at gmail.com>
>To: r-sig-mixed-models <r-sig-mixed-models at r-project.org>
>Subject: [R-sig-ME] Question about the optimal design of an experiment
>	for	ME models
>Message-ID:
>	<AANLkTinJdK+JWQg4Spn_cqzcH8aczEFEXFkpfyxXDycG at mail.gmail.com>
>Content-Type: text/plain
>
>I am designing a large-scale sampling effort aimed primarily at determining
>the influence of rainfall on nitrogen isotope (*15N*) values in trees.  My
>system is a precipitation gradient across a tropical rainforest and I am
>attempting to plan carefully before heading out into the field for what will
>amount to a great effort.  As the ecological world is not a perfect
>experimental system, soil fertility is found to vary as widely within
>different rainfall regimes as it does across the entire gradient.  This may
>greatly confound interpretations.  Also, tree species turnover across the
>gradient with no single species spanning the entire range (partially crossed
>combinations will be possible however).  I am therefore thinking of
>designing my sampling strategy to account for variation in my response
>brought on by these covariates.
>
>I believe this would be described as a nested or hierarchical mixed effects
>model (with partially crossed species) looking something like this:
>
>fit 1 <- lmer(15N ~  rainfall + ( 1 | fertility/plot/species )
>
>1) Am I correct that internally this model has the random effects of: ( 1 |
>fertility ) + ( 1 | fertility:plot ) + ( 1 | fertility:plot:species )?  And
>can *fertility* alternatively be fixed yet still have random effects nested
>within it?
>
>2) If *rainfall* is categorically binned into low, medium, and high what
>will I gain or lose versus if I treat it as continuous (say: 1900, 2400, and
>3600 mm)?  This could also go for *fertility* which could be represented as
>either artificially demarcated categories (low, medium, high) or as say a
>continuous principle component score to reduce dimensionality yet maintain
>continuity.
>
>3) Related to this, do I need 5 levels to accurately fit a random variable
>(as I've read elsewhere on this listserve) or is 3 O.K.?
>
>4) Also, if I am missing all of the 3 (or 5) categories of soil fertility
>for each rainfall level, will this doom the model fit?
>
>5) I expect to have 10 responses measured from each plot but only single, or
>possibly two, unique combinations.  Is it crazy to not replicate at the
>*plot* level within each "fertility*-*rainfall* combination ?
>
>If it helps the discussion, I imagine the data will look something like this
>in R:
>
>> imaginary data (15Npatterns)
>> str (15Npatterns)
>
>'data.frame':        __ obs. of 5 variables:
>$ 15N          :  num  1.00  1.52  -1.13   3.47   5.12   0.87   �
>$  rainfall     :  Factor w/ 3 levels "A", "B", "C":        1 1 2 2 3 3
>$  fertility     :  Factor w/ 3 levels "l", "m", "h":        ? ? ? ?
>$  plot          :  Factor w/ 3 levels "A:l", "B:m", "C:h" :    ? ? ? ?
>$  sample    :  Nominal :     Anacardium spp., Brosmium sp., etc.
>
>> summary(15Npatterns)
>rainfall    fertility        plot        sample
>A    : 2     l                 A:l          A:l:sp      : 10
>B    : 2    m               B:m        B:m:sp    : 10
>C    : 2    h                C:h         C:h:sp     : 10
>
>
>Thanks in advance and I appreciate any advice.
>
>-- 
>Jordan
>
>	[[alternative HTML version deleted]]
>
>
>
>------------------------------
>
>Message: 3
>Date: Sat, 19 Feb 2011 10:05:06 +0100
>From: Julia Sommerfeld <Julia.Sommerfeld at utas.edu.au>
>To: r-sig-mixed-models at r-project.org
>Subject: [R-sig-ME] Interpretation of lmer output in R
>Message-ID:
>	<AANLkTimwEDpKf9CXxPz8sV5PQnPjfebXhdDYv1_+5k1g at mail.gmail.com>
>Content-Type: text/plain
>
>Dear Douglas and list members,
>
>Apologies in advance if you might consider my questions as too simple to
>be asking the godfather of lme4 for an answer...thus, please feel free to
>ignore my email or to forward it to someone else.
>
>I'm a PhD student (Australia/Germany) working on tropical seabirds. As
>many of my PhD-collegues, I'm having some difficulties with the analysis
>of my data using lmer (family=binomial). While some say: What do you care
>
>about all the other values as long as you've got a p-value... I do believe
>that it is essential to understand WHAT I'm doing here and WHAT all these
>numbers/values mean.
>
>I've read the Chapters (lme4 Book Chapters) and publications about the use
>
>of lmer and searched the forums - but I don't find a satisfying answer.
>And I have the feeling that 1. the statistic lecture at my university was
>a joke (sad to say this) 2. that I need a huge statistical/mathematical
>
>background to fully understand GLMMs.
>
>
>One of the question I would like to answer is:
>Does the previous breeding success influences nest site fidelity?
>
>I have binomial data:
>SameSite=1 means birds use the same site
>
>SameSite=0 means birds change nest site
>
>BreedSuc1=1 Birds were successful in previous breeding season
>BreedSuc1=0 Birds were not successful "     "        "
>
>Sex= male, female
>Bird= Bird ID
>
>This is my model:
>fm<-lmer(SameSite~BreedSuc1+Sex+(1|Bird), family="binomial")
>
>where Bird is my random factor (same birds were sampled more than once)
>
>summary(fm)
>
>Generalized linear mixed model fit by the Laplace approximation
>
>Formula: SameSite ~ BreedSuc1 + Sex + (1 | Bird)
>   AIC   BIC logLik deviance
> 77.38 85.34 -34.69    69.38
>Random effects:
> Groups Name        Variance Std.Dev.
> Bird   (Intercept) 0.14080  0.37524
>Number of obs: 54, groups: Bird, 46
>
>Fixed effects:
>            Estimate Std. Error z value Pr(>|z|)
>(Intercept)  -0.3294     0.4890  -0.674   0.5006
>BreedSuc11    1.1988     0.5957   2.012   0.0442 *
>SexM          0.2215     0.5877   0.377   0.7062
>
>---
>Signif. codes:  0 �***� 0.001 �**� 0.01 �*� 0.05 �.� 0.1 � � 1
>
>Correlation of Fixed Effects:
>           (Intr) BrdS11
>BreedSuc11 -0.536
>SexM       -0.628  0.065
>
>
>>From this summary output I do understand that the Breeding Success has a
>
>significant effect on nest-site fidelity (p<0.05).
>
>But what else can I conclude from this model?
>
>Questions:
>
>1.Random effects: What does the Random Effect table - the Variance, Std.
>Dev. and Intercept - tells me: Is there a random effect that my model has
>
>to account for?
>
>Random effects:
> Groups Name        Variance Std.Dev.
> Bird   (Intercept) 0.14080  0.37524
>Number of obs: 54, groups: Bird, 46
>
>2. Fixed Effects: Again the Intercept? Not sure if I understand the
>
>meaning of it (sorry, explanation in Chapter I also doesn't help much)
>
>Fixed effects:
>            Estimate Std. Error z value Pr(>|z|)
>(Intercept)  -0.3294     0.4890  -0.674   0.5006
>BreedSuc11    1.1988     0.5957   2.012   0.0442 *
>
>SexM          0.2215     0.5877   0.377   0.7062
>
>3. Meaning of the z-value? Why shall I mention it in te result section?
>
>4. Estimate and Std. Error of the fixed effects? How can I tell from these
>values WHAT kind of effect (positiv, negativ?) these parameter have on
>
>nest-site fidelity? Do birds that were successful during the previous
>breeding success show a higher nest-site fidelity? Remember, I have
>binomial data...
>
>I would highly appreciate your feedback and/or suggestions of
>
>papers/chapters I could read for a better understanding of the output.
>
>Best regards,
>
>
>Julia
>
>	[[alternative HTML version deleted]]
>
>
>
>------------------------------
>
>_______________________________________________
>R-sig-mixed-models mailing list
>R-sig-mixed-models at r-project.org
>https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
>End of R-sig-mixed-models Digest, Vol 50, Issue 38
>**************************************************


More information about the R-sig-mixed-models mailing list