[R-sig-ME] Fitting interaction term in GAMM with random effect
samantha.cox at plymouth.ac.uk
Tue Apr 5 17:43:52 CEST 2016
First sorry for cross posting with the R datatable help page - I was not sure which list is more appropriate.
I am trying to fit a model with a random effect of DeploymentID with a nested AR1 autoregressive correlation structure. For the fixed component I am fitting a smooth of tide. I have two sets of models I am fitting with different data sets. For the smooth of tide, I want a separate smooth to be fitted per SiteID. In one set of models this is fine (each SiteID contains multiple DeploymentIDs). In the other SiteID and DeploymentID are identical. I am wondering how to code this. I am not interested in the intercept of SiteID hence why it has previously been a random effect. I am interested in how smooths vary between SiteIDs and hence why this is a fixed effect.
Example data structure first data set:
Example data structure seconddata set:
My problem is that I understand to fit a interaction term, one must use
- if I include +SiteID then I should NOT include DeploymentID as a random effect also (for the second model where SiteId and DeploymentID are identical - but this is ok for the first model)?
- the problem is when I want to compare nested models I run into issues if the smooth term is dropped as I do not have a random or smooth term in the model.
Can I code as
Any help on this is appreciated....
This email and any files with it are confidential and intended solely for the use of the recipient to whom it is addressed. If you are not the intended recipient then copying, distribution or other use of the information contained is strictly prohibited and you should not rely on it. If you have received this email in error please let the sender know immediately and delete it from your system(s). Internet emails are not necessarily secure. While we take every care, Plymouth University accepts no responsibility for viruses and it is your responsibility to scan emails and their attachments. Plymouth University does not accept responsibility for any changes made after it was sent. Nothing in this email or its attachments constitutes an order for goods or services unless accompanied by an official order form.
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models