[R] Test for multiple comparisons: Nonlinear model, autocorrelation?

Spencer Graves spencer.graves at pdf.com
Sun Jul 6 17:38:51 CEST 2008


      If I had only a very limited time to do this, I might include 
'month' as another effect, probably coded as 'sin' and 'cos' on an 
annual cycle rather than as 12 individual Indicators.  This would allow 
you to explore not only main effects but interactions with plots. 

      Before I did that, however, I'd want to generate more plots of 
data, residuals, and coefficients.  For example, 
qqnorm(resid(fm1Soy.nlme), datax=TRUE) displayed an S shape that 
indicated inhomogeniety of variance.  This suggests that there is 
something else to be modeled in these data.  I would next try plotting 
residuals by 'month'.  I'd also plot the averages and standard 
deviations by 'month'.  This might tell me if I only need to add a fixed 
annual cycle, and how much of a Fourier series approximation to add.  If 
the standard deviations show a pattern, it suggests I need to model 
heteroscedasticity.  For that see '?varClasses' and the corresponding 
information in a book by Pinheiro and Bates (2000), mentioned on that 
help page.  You can do 'anova' for any of these effects.  [To test 
changes in fixed effects, you will need to use method='ML', as discussed 
in a book by Pinheiro and Bates (2000).]

      Hope this helps. 
      Spencer

J S wrote:
>
> Thanks. Here is a similar example from a book by Pinheiro and Bates 
> (2000, chapter 6):
>
>  
>
> library(nlme)
> data(Soybean)
>
> fm1Soy.lis <- nlsList( weight ~ SSlogis(Time, Asym, xmid, scal),
>    data = Soybean )
> fm1Soy.nlme <- nlme( fm1Soy.lis )
>
>  
>
> *If we would like to make comparisons among the years we could just 
> simply involve years as a covariate, and later we could use L argument 
> to ANOVA to could compute contrasts. *
>
>  
>
> soyFix <- fixef( fm1Soy.nlme )
>  fm2Soy.nlme <- update( fm1Soy.nlme,
>    fixed = Asym + xmid + scal ~ Year,
>    start = c(soyFix[1], 0, 0, soyFix[2], 0, 0, soyFix[3], 0, 0) )
>
> * *
>
> *My question is: How can I compare variety of soybeans in a separate 
> month, i.e. if there was a difference in weight of soybeans F and P in 
> first month, …in twelve month?*
>
>  
>
> The dataset “Soybean”:
>
>       Plot Variety Year Time    weight
>
> 1   1988F1       F 1988   14  0.106000
>
> 2   1988F1       F 1988   21  0.261000
>
> 3   1988F1       F 1988   28  0.666000
>
> 4   1988F1       F 1988   35  2.110000
>
> 5   1988F1       F 1988   42  3.560000
>
> ….
>
> 407 1990P8       P 1990   30  1.478330
>
> 408 1990P8       P 1990   37  2.601667
>
> 409 1990P8       P 1990   43  6.343330
>
> 410 1990P8       P 1990   51  6.131670
>
> 411 1990P8       P 1990   64 16.411700
>
> 412 1990P8       P 1990   79 16.946700
>
>  
>
> 1)      Involving months and variety as a covariates will probably 
> create too many parameters for the model?
>
> 2)      Is it possible to use some test for comparisons, let’s say t 
> test? Perhaps not in case the data are dependent (i.e. previous 
> measurement is dependent on the next measurement, i.e. there is 
> temporal correlation (as in my study of Soil temperature)? What is an 
> alternative suggestion?
>
>  
>
> Thanks,
>
> Julia
>
>
>
> > Date: Fri, 4 Jul 2008 17:36:29 -0700
> > From: spencer.graves at pdf.com
> > To: yulya258 at hotmail.com
> > CC: r-help at r-project.org
> > Subject: Re: [R] Test for multiple comparisons: Nonlinear model, 
> autocorrelation?
> >
> > The question seems too general for me to offer specific suggestions.
> >
> > What problem are you trying to solve that you think 'multiple
> > comparisons' will answer?
> >
> > Can you produce a similar problem that is completely self-contained
> > example that eliminates complexity that may not be needed to understand
> > your question (similar to the 'Auxiliary Problem' technique in "How to
> > Solve It", http://en.wikipedia.org/wiki/How_to_Solve_It)? If you 
> can, it
> > may lead you to a solution. If you get such an example but still can't
> > see a solution, send that example to this list (following the advice in
> > the posting guide http://www.R-project.org/posting-guide.html). The
> > simpler the example, the more likely someone on this list will reply
> > quickly with a useful suggestion.
> >
> > I know this doesn't solve your problem, but I hope it helps.
> > Spencer
> >
> > J S wrote:
> > > Dear R community,
> > >
> > > I have a nonlinear model describing average daily soil 
> temperature. What test should I use to compare differences in soil 
> temperature of the two studied vegetation types depending upon month?
> > >
> > > Building linear contrasts for the developed nonlinear model does 
> not help since this model does not include variable “Months” (only 
> “Days”).
> > >
> > > 1) Just a Student’s test is not probably an option because I would 
> violate an assumption of independency, since the daily soil 
> temperature observations have high autocorrelation. Or maybe I could 
> average the observations for each month and then use this test since I 
> have observations for a few years, and it might overcome the problem 
> of independency?
> > >
> > > 2) Should I develop a second nonlinear model with months instead 
> of days, but it would considerably increase a number of parameters in 
> the model...
> > >
> > > Or:
> > > 3) ?
> > >
> > > Thanks for your help,
> > > Julia
> > > _________________________________________________________________
> > > It’s a talkathon – but it’s not just talk.
> > >
> > > [[alternative HTML version deleted]]
> > >
> > >
> > > 
> ------------------------------------------------------------------------
> > >
> > > ______________________________________________
> > > R-help at r-project.org mailing list
> > > 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.
> > >
>
> ------------------------------------------------------------------------
> The i’m Talkaton. Can 30-days of conversation change the world? Find 
> out now. 
> <http://www.imtalkathon.com/?source=EML_WLH_Talkathon_ChangeWorld>



More information about the R-help mailing list