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

## Simulate some t data...
dat <- gamSim(1,n=n)
dat$y <- dat$f + rt(n,df=4)*2

b <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),family=scat(link="identity"),data=dat)

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)
f$getTheta(trans = TRUE)

which produces:

> f <- family(b)
> args(f$getTheta)
function (trans = FALSE) 
> f$getTheta()
[1] 0.8653386 0.7362529
> f$getTheta(trans = TRUE)
[1] 5.375810 2.088097
  • $\begingroup$ Thank you very much for your detailed answer! :) I have read a couple of posts regarding GAMs and your answers were always very helpful! $\endgroup$
    – Henry
    Nov 17 '21 at 16:36

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),
        family=scat(theta=c(10, 2), link="identity"),

which now outputs Family: Scaled t(10,2)

edit: See also Simpson's answer bellow


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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