library("gamlss2")
## create family object with
## different link specifications
<- Kumaraswamy(a.link = shiftlog, b.link = "log")
fam
## simulate data
set.seed(123)
<- 1000
n <- data.frame("x" = runif(n, -pi, pi))
d
## true parameters
<- data.frame(
par "a" = exp(1.2 + sin(d$x)) + 1,
"b" = 1
)
## sample response
$y <- fam$r(1, par)
d
## estimate model using the Kumaraswamy family
<- gamlss2(y ~ s(x), data = d, family = fam) b
GAMLSS-RS iteration 1: Global Deviance = -1503.9979 eps = 0.674665
GAMLSS-RS iteration 2: Global Deviance = -1504.1074 eps = 0.000072
GAMLSS-RS iteration 3: Global Deviance = -1504.1261 eps = 0.000012
GAMLSS-RS iteration 4: Global Deviance = -1504.1293 eps = 0.000002
## plot estimated effect
plot(b)
## plot residual diagnostics
plot(b, which = "resid")