Extracting the degrees of freedom of a GAM

I would have a rather easy question regarding the output when fitting a GAM using the mgvz package and assuming t distributed data.

Sample code is taken from https://stat.ethz.ch/R-manual/R-devel/library/mgcv/html/scat.html

library(mgcv)
## Simulate some t data...
set.seed(3);n<-400
dat <- gamSim(1,n=n)
dat$$y <- dat$$f + rt(n,df=4)*2

summary(b) yields the output “Family: Scaled t(5.376,2.088)”.

My question is whether I am right assuming that:

• 5.376 = degrees of freedom of the t distribution (nu)

• 2.088 = sigma

To get the actual values directly, {mgcv} has this hidden functionality of an extractor function buried in the family object of the fitted model. If the model has some additional parameters like the scaled t or negative binomial (nb()) families, there will be a function getTheta in the family.

These are not typically well documented in the {mgcv} help, unfortunately. Usually what is returned by getTheta() will be on the scales used for actual model fitting. To get them back on a more useful scale (like the $$\nu$$ and $$\sigma$$ parameters displayed in the output from summary()) getTheta() typically has a trans argument:

f <- family(b)
args(f$getTheta) f$getTheta()
f$getTheta(trans = TRUE) which produces: > f <- family(b) > args(f$getTheta)
function (trans = FALSE)
NULL
> f$getTheta()  0.8653386 0.7362529 > f$getTheta(trans = TRUE)
 5.375810 2.088097

The documentation is a bit confusing, but the first is nu and the second is sigma as is explained in the docs for the argument theta

the parameters to be estimated nu = b + exp(theta_1) (where ‘b’ is min.df) and sig = exp(theta_2). If supplied and both positive, then taken to be fixed values of nu and sig. If any negative, then absolute values taken as starting values.

you can check this by providing those values yourself

b <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),