I am using GAM to fit a smooth line to represent the recovery of timber stocks following forest harvest. The data is heterogenous and I do not want to transform it. I understand that a nice way to accommodate the heterogeneity in my data is to add a fixed variance structure.
However, when I try this in GAM I get the following error message: "Error in model.frame.default(formula = t ~ 1 + age, weights = varFixed(~age), : variable lengths differ (found for '(weights)')"
I don't understand why the variable lengths would differ since I am using 'age' for specifying both the fixed variance structure and also the explanatory variable. Have a look: M1<- gam(t~s(age), method = 'REML', weights = varFixed(~age))
Any suggestions would be welcome!