This is my first post on here, looking for some help. I am relatively new to analysis of temporal datasets. I have experience with R and developing linear models, so I am trying to figure out if the approach I am trying is appropriate with temporal data or if I need to do something different.
Data: Monthly measurements of metal concentrations that span one year, with a few missing months. With the missing months, I am pretty I can't set up a true time series analysis in R (right?). I have several predictor variables (rainfall, temp, etc) that I want to evaluate.
Approach: Construct a GLM with terms for each predictor and sampling month. I am considering using the gls function in nlme package in R so that I could examine autocorrelation.
Goal: Identify factors to explain pattern in temporal water data
Questions: - Can I use a glm approach with temporal data, even if there may be seasonality to the data? - How do i test for temporal autocorrelation in the error terms? I know there are some correlation structures that I could set up in gls but haven't figured out how to set this up and which one is best for testing temporal autocorrelation yet.
Example dataset and approach is below. I would appreciate advice on if what I propose seems appropriate. If not, suggestions of alternative approaches would be a great help.
dat<-data.frame(month=c("Jan","Jan","Jan","Feb","Feb","Feb","Jun","Jun","Jun"), wat=c(0.4,0.5,0.6,1,1.5,1.8,0.4,0.3,0.8), rain = c(100,110,120,200,210,220,300,310,330), temp = c(10,11,12,14,12,13,10,12,8)) m0<-gls(wat~month+rain+temp,correlation = corAR1(),data=dat)