I have a regression with a harmonic effect of day of the year, which interacts with other variables. I am not sure how to interpret the coefficients. My model is:

`m1 <- lme(lcount ~ AirT + sin(2*pi/360*DOY) + cos(2*pi/360*DOY) + AirT*sin(2*pi/360*DOY) + AirT*cos(2*pi/360*DOY) + RainAmt + RainAmt*AirT, random = ~1|plot)) `

I get significant interaction effects of air temperature with the linearized harmonic day of the year (DOY) function. My response variable is the log of animal counts on each day. I want to describe how the effect of air temperature on animal observations changes depending on the day of the year.

Does anyone have suggestions on how I can interpret my beta values and/or how I can visualize the effect? I am using R but am not that skilled. The package I used for analyzing my data is nlme.

EDIT: **My primary goals are (1) to describe the response of animals to environmental variables and (2) to predict future activity periods (i.e. when and under what conditions should a research bother trying to catch these animals).** So if there is a better way to model this data, I would be interested in hearing it (such as cubic splines – see comments below).

**Contents**hide

#### Best Answer

Before you do any more modelling I'd definitely try to get a good visualisation of the data. Lattice graphics are good at this sort of thing. One trick might be to cut up the DOY variable into months, seasons, or whatever are the meaningful divisions in your field. Then you can do a different plot for each season showing the different relationship between the air temperature and animal count. The code below does this by breaking DOY automatically into 12 equal parts.

`library(lattice) xyplot(lcount~AirT | cut(DOY, 12), panel=function(x,y){ panel.xyplot(x, y) panel.loess(x, y, span=1)}) `

You can experiment with different ways of showing your location effect – different coloured characters for different plots, or you can feed it into the formula above (eg replace the formula above with "lcount~AirT | cut(DOY, 4) + location") and get a different plot for each combination of location and quarter (assuming quartering the year is useful for you – probably isn't so you need some other way of dividing up DOY).

Have a read of the help files for xyplot and lattice.

Do you have Pinheiro and Bates' book on mixed effects models in S-Plus? Very similar to R and lots of good advice on this sort of issue. My copy's not here right now.