I need some advice to understand the following code. We are working with lung data and usually we use LMS technique to calculate the reference curves. In order to calcualte the curves with LMS method from gamlss package we use the following code (forexample)
library(gamlss)
A<-lungFunction
m1 <- gamlss(slf ~ log(height) + pb(log(age)), sigma.fo =~pb(log(age)), nu.fo =~pb(log(age)), family = BCCGo(mu.link = "log"), data=A)
the link for µ needs to be the log.
It seems that LMS method is not appropriate method when the response variable is a ratio or proportion, So inflated logitSST distributions is proposed instead. In an article, the following code was used to calculate the centile curves for slf which is a proportion (0,1]. I could not understand why ga function and s function were used to define the µ. So any advice regarding that would be highly appreciated. I am also wondering how I can Implement the prediction equation and and the contribution of the splines (Mu,Sigma,nu) varies with age. In LMS method when the link function for Mu is log function then we take exp function for back transformation but I have no idea how we can do it when we define mu.formula = ~ ga(~s(log(height), log(age)))
library(gamlss.inf)
library(gamlss.add)
gen.Family("SST", "logit")
mf1 <- gamlssInf0to1(y=slf,
mu.formula = ~ ga(~s(log(height), log(age))),
sigma.formula = ~pb(log(age)),
nu.formula = ~pb(log(age)),
tau.formula = ~pb(log(age)),
xi1.formula = ~pb(log(age))+ pb(log(height)),
family = logitSST,
data = A,
n.cyc = 100,
trace = TRUE)
ga
is an interface togam
from themgcv
package. To generate the reference curves, you'd normally use thepredict
function. You don't need to backtransform anything by hand. $\endgroup$