[R] mixed models

James Henson jfhenson1 at gmail.com
Fri May 27 19:07:33 CEST 2016


Greetings Jeff,
You are correct that the unequal number of levels is not the problem.
I revised the data frame so that the number of levels was equal and
the same error message occurred.  The code is below, and the
Eboni2.txt file is attached. This problem baffles me.  I appreciate
any help.
Best regards,
James
 Eboni2 <- read.csv("Eboni2.csv", header = TRUE)

library("nlme")

str(Eboni2)

head(Eboni2)

model1 <- lme(preDawn ~ Irrigation, random=~season_order|treeNo, data=Eboni2)

On Wed, May 25, 2016 at 6:23 PM, Jeff Newmiller
<jdnewmil at dcn.davis.ca.us> wrote:
> Please keep the mailing list in the loop by using reply-all.
>
> I don't think there is a requirement that the number of levels is equal, but
> there may be problems if you don't have the minimum number of records
> corresponding to each combination of levels specified in your model.
>
> You can change the csv extension to txt and attach for the mailing list. Or,
> better yet, you can use the dput function to embed the data directly in your
> sample code.
>
> Also, please learn to post plain text email to avoid corruption of R code by
> the HTML formatting.
> --
> Sent from my phone. Please excuse my brevity.
>
> On May 25, 2016 2:26:54 PM PDT, James Henson <jfhenson1 at gmail.com> wrote:
>>
>> Good afternoon Jeff,
>> The sample sizes for levels of the factor "Irrigation" are not equal. If
>> 'nlme' requires equal sample sizes this may be the problem. The same data
>> frame runs in 'lme4' without a problem.
>>
>> Best regards,
>> James
>>
>>
>> On Wed, May 25, 2016 at 3:41 PM, James Henson <jfhenson1 at gmail.com> wrote:
>>>
>>> Good afternoon Jeff,
>>>
>>> When working with this data frame, I just open the .csv file in R Studio.
>>> But, we should not send .csv file to R_help.  What should I send?
>>>
>>> Best regards,
>>> James
>>>
>>> On Wed, May 25, 2016 at 2:52 PM, Jeff Newmiller
>>> <jdnewmil at dcn.davis.ca.us> wrote:
>>>>
>>>> You forgot to show the commands to us that you used to read the data in
>>>> with (your example is not "reproducible"). This step can make all the
>>>> difference in the world as to whether your analysis commands will work or
>>>> not.
>>>> --
>>>> Sent from my phone. Please excuse my brevity.
>>>>
>>>> On May 25, 2016 11:59:06 AM PDT, James Henson <jfhenson1 at gmail.com>
>>>> wrote:
>>>>>
>>>>> Greetings R community,
>>>>>
>>>>> My aim is to analyze a mixed-effects model with temporal
>>>>> pseudo-replication
>>>>> (repeated measures on the same experimental unit) using ‘nlme’.
>>>>> However,
>>>>> my code returns the error message “Error in na.fail.default’, even
>>>>> though
>>>>> the data frame does not contain missing values. My code is below, and
>>>>> the
>>>>> data file is attached as ‘Eboni2.txt.
>>>>>
>>>>> library("nlme")
>>>>>
>>>>> str(Eboni2)
>>>>>
>>>>> head(Eboni2)
>>>>>
>>>>> model1 <- lme(preDawn ~ Irrigation, random=~season_order|treeNo,
>>>>> data=Eboni2)
>>>>>
>>>>> I am genuinely confused.  Hope someone can help.
>>>>>
>>>>> Best regards,
>>>>>
>>>>> James F. Henson
>>>>>
>>>>> ________________________________
>>>>>
>>>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>> PLEASE do read the posting guide
>>>>> http://www.R-project.org/posting-guide.html
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>>
>



More information about the R-help mailing list