[R] te( ) interactions and AIC model selection with GAM

2012-07-30 Thread Ricardogg
Hello R users, I'm working with a time-series of several years and to analyze it, I’m using GAM smoothers from the package mgcv. I’m constructing models where zooplankton biomass (bm) is the dependent variable and the continuous explanatory variables are: -time in Julian days (t), to creat a long-

Re: [R] how to calculate seasonal mean for temperatures

2012-08-01 Thread Ricardogg
Here is my approximation: # Creation of the temporal variables DF$year <- as.numeric(format(DF$date, format = "%Y")) DF$month <- as.numeric(format(DF$date, format = "%m")) # For years with data from 2006 to 2008 DF_type1 <- DF [ - which (year == 2006 & month ==1 | year == 2006 & month == 2 |

Re: [R] how to calculate seasonal mean for temperatures

2012-08-01 Thread Ricardogg
You're totally right Jeff. My mistake! to use with, we write it like this: DF$season <- factor ( with ( *DF*, ifelse (( month == 12 | nonth == 1 | month == 2 ), "Win", ifelse ((month == 3 | nonth == 4 | month == 5 ) , "Spr", ifelse

Re: [R] as.date: do not know how to convert 'mydata[1]' to class "Date"

2012-08-01 Thread Ricardogg
For me it owrks when i write it like: as.Date(paste(mydata$Delivery.Date), "%m/%d/%Y") Hope it works, Regards, Ricardo -- View this message in context: http://r.789695.n4.nabble.com/as-date-do-not-know-how-to-convert-mydata-1-to-class-Date-tp4638691p4638696.html Sent from the R help mailin

Re: [R] te( ) interactions and AIC model selection with GAM

2012-08-02 Thread Ricardogg
- About the visualization, my question is more about interpretation. In the case of : model_name <- gam ( bm ~ t + te (t_year, temp_W, temp_sept, k = 5, bs = c( “cc”,”cr”,”cr”)), data = data) * a)* vis.gam (model_name , view= c(“t_year”, “temp_W”)) *b)* vis.gam (model_name , view= c(“t_year

Re: [R] te( ) interactions and AIC model selection with GAM

2012-08-02 Thread Ricardogg
- About the first question, I was not sure about what was the proper model ( a) or b) ) because I saw this at the end of the help for te ---> ?te : n <- 500 v <- runif(n);w<-runif(n);u<-runif(n) f <- test2(u,v,w) y <- f + rnorm(n)*0.2 # tensor product of 2D thin plate regression spline and 1D c