glmmTMB- fitting splines
Hello again, Thank you so much for your detailed explanation! Best, D Sent from Outlook<http://aka.ms/weboutlook>
From: John Maindonald <john.maindonald at anu.edu.au>
Sent: Monday, May 21, 2018 10:00 PM
To: dani
Cc: r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] glmmTMB- fitting splines
Sent: Monday, May 21, 2018 10:00 PM
To: dani
Cc: r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] glmmTMB- fitting splines
The spline coefficients multiply the two basis terms. Most times, one wants to work with predicted values and standard errors. The predict method seems not yet to have been implemented for glmmTMB models with a betabinomial error family. One can use fitted() to get just the fitted probabilities, and do a complementary log-log transform (in this instance) to get predictions on the scale of the linear predictor (NB, linear in the sense that it is a linear combination of the basis functions, plus intercept). The output suggests that the first basis term might be enough on its own. Observe, however, to choose a simple case: > x <- 1:5; splines::ns(x, 2)[, 1] [1] 0.0000000 0.3570466 0.5662628 0.5290951 0.3440969 This is a very nonlinear function of x, quite different from the linear function of x that one gets by typing splines::ns(x, 1) Regression thin plate splines, as implemented in mgcv. have the advantage that the initial basis terms change only very slightly as one moves to a higher degree of freedom basis. John Maindonald email: john.maindonald at anu.edu.au<mailto:john.maindonald at anu.edu.au> On 22/05/2018, at 14:41, dani <orchidn at live.com<mailto:orchidn at live.com>> wrote: Hi John, Thank you so much! This is very helpful! I managed to run it but I am not sure how to interpret the results as I get this: # Conditional model: # Estimate Std. Error z value Pr(>|z|) # (Intercept) -8.40461 1.58077 -5.317 1.06e-07 *** # splines::ns(newage, 2)1 -1.89262 0.57246 -3.306 0.000946 *** # splines::ns(newage, 2)2 0.10296 0.47268 0.218 0.827575 I am not sure what to make of the two different spline results. Best regards, D ________________________________ From: John Maindonald <john.maindonald at anu.edu.au<mailto:john.maindonald at anu.edu.au>> Sent: Monday, May 21, 2018 7:10 PM To: dani Cc: r-sig-mixed-models at r-project.org<mailto:r-sig-mixed-models at r-project.org> Subject: Re: [R-sig-ME] glmmTMB- fitting splines There is an example at http://www.rpubs.com/johnhm/Overdispersed See Section 2.2 . John Maindonald email: john.maindonald at anu.edu.au<mailto:john.maindonald at anu.edu.au> On 22/05/2018, at 11:36, dani <orchidn at live.com<mailto:orchidn at live.com>> wrote: