Search code examples
mixed-modelsgammgcv

Formal quotation of smooth random terms in mgcv::gam mixed model


I have a mgcv::gam mixed model of the form:

m1 <- gam(Y ~ A + s(B, bs = "re"), data = dataframe, family = gaussian,
 method = "REML")

The random term s(B, bs = "re") is quoted in summary(m1) as, for example,

Approximate significance of smooth terms:
           # edf Ref.df      F p-value   
s(B)  4.486      5 97.195 6.7e-08 ***

My question is, how would I quote this result (statistic and P value) in a formal document, for example a technical report or paper?

For example, one possibility is

F[4.486,5] = 97.195, P = 6.7e-08

However, arguing against this idea, “reverse engineering” of the result using

pf(q= 97.195, df1= 4.486, df2= 5, lower.tail=FALSE)

gives an incorrect p value:

[1] 5.931567e-05

I would be very grateful for your advice. Many thanks for your help!


Solution

  • The F statistic in question doesn't actually follow an F with the degrees of freedom you have identified. The Ref df one is related to the test, but you'd need to read and understand Wood (2013) to fully grep how the degrees of freedom for the test are derived.

    I would simply quote the statistic and the p-value and then cite Simon's paper if anyone wants to know how they were computed. I don't think you can easily get at the degrees of freedom that actually get used. (well, not without debugging the summary.gam() code and seeing how they are computed.)

    References

    Wood, S. N. 2013. A simple test for random effects in regression models. Biometrika 100: 1005–1010. doi:10.1093/biomet/ast038