Hello - I am attempting to add interaction terms to a model using the gamm function in the mgcv package. I stripped it down to only two terms to simplify it. I have no trouble with individual terms, continuous or factors, nor with interacting factor terms; I cannot, however, figure out how to add interactions between continuous*factor terms. I applied a smoother to my continuous term because it has a non-linear trend over time. Below is an example of my attempt, followed by the error message:
MMF.Test <- gamm(MaxDepth ~ s(TripTime) + Trtmt + s(TripTime):Trtmt, random = list(Seal =~1), method = "REML", data = EsealsAll) "Error in model.frame.default(formula = MaxDepth ~ Trtmt + s(TripTime):Trtmt + : invalid type (list) for variable 's(TripTime)' In addition: Warning message: In sp[i] <- ind : number of items to replace is not a multiple of replacement length" I thought this was a problem with trying to use different vector lengths, but the length of both is the same (1001). Help please? What am I doing wrong? Not sure if my mistake is one of faulty statistical reasoning, or incompetence with R. Thank you in advance for any suggestions! ~~~~~~~~~~~~~~~~~~~~~ Jennifer Maresh, PhD Student Center for Ocean Health, Long Marine Lab 100 Shaffer Rd. University of California Santa Cruz, CA 95060 mar...@biology.ucsc.edu ______________________________________________ R-help@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.