# NOT RUN {
# fit model on raw hgt with knots at 0, 1, 2 and 3 years
fit1 <- brokenstick(hgt ~ age | id, smocc_200, knots = 0:3)
gp <- c(10001, 10005, 10022)
plot(fit1, smocc_200,
group = gp, xlim = c(0, 2.1),
xlab = "Age (years)", ylab = "Length (cm)"
)
# fit model on standard deviation score
fit2 <- brokenstick(hgt.z ~ age | id, smocc_200, knots = 0:3)
plot(fit2, smocc_200,
group = gp, xlim = c(0, 2.1),
xlab = "Age (years)", ylab = "Length (SDS)"
)
# model with 11 knots
plot(fit_200, smocc_200,
group = gp, xlim = c(0, 2.1),
xlab = "Age (years)", ylab = "Length (SDS)"
)
# }
Run the code above in your browser using DataLab