[R] Periodic regression - lunar percent cover

Greg Snow Greg.Snow at imail.org
Sat May 1 01:24:29 CEST 2010


You have the correct general idea, but it looks like lp may have already been transformed to be in the range 0-1 rather than number of days, if that is the case then you don't need to dived by 29. Again.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Tim Clark
> Sent: Thursday, April 29, 2010 5:50 PM
> To: r-help at r-project.org
> Subject: [R] Periodic regression - lunar percent cover
> 
> Dear List,
> 
> I am trying include a lunar variable in a model and am having problems
> figuring out the correct way to include it.  I want to convert the
> percent lunar illumination (fraction of moon showing) to a combination
> of sin and cos variables to account for the periodic nature of the
> lunar cycle.  Would someone let me know if I am doing this correctly?
> I have included the first 20 variables from my dataset as an example.
> Y is count data and lp is the lunar percent cover.  The lunar period is
> 29.53.
> 
> y<-c(1, 3, 0, 0, 0, 0, 2, 4, 0, 1, 0, 5, 3, 2, 4, 2, 0, 1, 3, 5)
> lp<-c(0.80, 0.88, 0.62, 0.19, 0.21, 0.01, 0.70, 1.00, 0.88, 0.04, 0.70,
> 0.93, 0.23, 0.99, 0.19, 0.79, 1.00, 0.03, 0.01, 0.00)
> g1<-glm(y~cos((2*pi*lp)/29.530589)+sin((2*pi*lp)/29.530589))
> 
> Thanks,
> 
> Tim
> 
> 
> 
> 
> Tim Clark
> Department of Zoology
> University of Hawaii
> 
> ______________________________________________
> 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.



More information about the R-help mailing list