Re: [R-sig-eco] Cosinor with data that trend over time

2014-03-30 Thread Jacob Cram
Thanks Gavin, Your suggestion seems promising. I don't think I'll do the derivatives analysis at this time so no hurry on those codes. New question. I am wondering if there are additional considerations when making multiple comparasons with a gamm model. I have been testing a large number of

Re: [R-sig-eco] Cosinor with data that trend over time

2014-03-26 Thread Gavin Simpson
1) Visually - unless it actually matters exactly on which day in the year the peak is observed? If visually is OK, just do `plot(mod, pages = 1)` to see the fitted splines on a single page. See `?plot.gam` for more details on the plot method. 2) You could generate some new data to predict upon as

Re: [R-sig-eco] Cosinor with data that trend over time

2014-03-26 Thread Jacob Cram
Thanks again Gavin, this works. gamm() also models the long term trend with a spline s(Time), which is great. I would still like though, to be able to say whether the factor is trending up or down over time. Would it be fair to query summary(mod$lme)$tTable and to look at the p-value and Value

Re: [R-sig-eco] Cosinor with data that trend over time

2014-03-26 Thread Gavin Simpson
Sorry about the errors (typos, not syntax errors) - I was forgetting that you'd need to use `gamm()` and hence access the `$gam` component I don't follow the point about a factor trending up or down. You shouldn't try to use the `$lme` part of the model for this. `summary(mod$gam)` should be

[R-sig-eco] Cosinor with data that trend over time

2014-03-25 Thread Jacob Cram
Hello all, I am thinking about applying season::cosinor() analysis to some irregularely spaced time series data. The data are unevenly spaced, so usual time series methods, as well as the nscosinor() function are out. My data do however trend over time and I am wondering if I can feed date as

Re: [R-sig-eco] Cosinor with data that trend over time

2014-03-25 Thread Gavin Simpson
I would probably attack this using a GAM modified to model the residuals as a stochastic time series process. For example require(mgcv) mod - gamm(y ~ s(DoY, bs = cc) + s(time), data = foo, correlation = corCAR1(form = ~ time)) where `foo` is your data frame, `DoY` is a