0
$\begingroup$

I'm working with a dataset of 56 samples, so I am trying to keep the complexity of the regression model down. However, I have rather complex non linear relationships between some of the predictors and variables. I also have spatial autocorrelation in the model residuals. Thus, I'm using gamm with a spatial correlation structure . I use this formula:

gamm(y ~ s(x, k=-1), correlation=corSpher(form=~x+y), data=d)

Estimated degrees of freedom is total=7.98. The residual plot looks ok with this model (fig1). However, if I constrain k to a smaller number (k=7), the residual plot looks messed up (fig2). See plots below.

I'm thinking that constraining the number of knots to a lower number, is not a good idea because of the residuals. But isn't it also problematic to have a high number of knots, when the sample size is rather small? Does anyone have any advice on how to deal with this?

fig1

fig2

$\endgroup$

1 Answer 1

0
$\begingroup$

Why do you think that having a large number of knots is problematic? If you use a regularized smoother the penalty term should take care of it. This is definitely the case for P-spline smoothers (I think option bs = "ps" in the s() function of mgcv). You can refer to Eilers et al. (2015) (see section 2.3 for your specific question).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.