| growthIndiana | R Documentation |
Repeated height measurements of 216 adolescents, about every 6 months between the ages of 5 and 20, from a study
of the development of hypertension at the Indiana University School of Medicine, Indianapolis (Pratt et al.
1989); the same data as HRW::growthIndiana. The data of M. P. Wand's examples of subject-specific
curves (Harezlak, Ruppert and Wand 2018, section 9.2), which semireg reproduces
(tests/testthat/test-semireg-golden.R).
data(growthIndiana)
A data frame with 4123 rows and 5 columns:
identification number of the adolescent.
height (cm).
age (years).
1 for a boy, 0 for a girl.
1 for a black adolescent, 0 otherwise.
Pratt, J. H., Jones, J. J., Miller, J. Z., Wagner, M. A. and Fineberg, N. S. (1989). Racial differences in aldosterone excretion and plasma aldosterone concentrations in children. New England Journal of Medicine, 321, 1152-1157.
Harezlak, J., Ruppert, D. and Wand, M. P. (2018). Semiparametric Regression with R. Springer.
data(growthIndiana)
# black boys: a mean curve, and each boy's own curve, a straight line (age | idnum)
# plus a spline deviation with one variance for all boys
gbm <- subset(growthIndiana, male == 1 & black == 1)
gbm$idnum <- factor(gbm$idnum)
fit <- semireg(height ~ s(age, bs = "os", k = 20, xt = list(range = c(5.5, 20))) +
(s(age, k = 10, xt = list(range = c(5.5, 20))) | idnum), data = gbm)
anova(fit)$smooth # are the boys' curves straight lines?
semipred(fit, "age", "age")$plt
## Not run:
# (about 30 s: 2257 measurements, 130 boys' curves)
# all boys: a common curve and a black-white deviation curve (the contrast curve of
# Harezlak, Ruppert and Wand); at which ages do the races differ, and in growth rate?
gm <- subset(growthIndiana, male == 1)
gm$idnum <- factor(gm$idnum)
gm$race <- factor(ifelse(gm$black == 1, "black", "white"))
fit2 <- semireg(height ~ s(age, race, bs = "os", k = 20, xt = list(range = c(5.5, 20))) +
(s(age, k = 10, xt = list(range = c(5.5, 20))) | idnum), data = gm)
dif <- semipred(fit2, "race", "age", contr = c("black", "white"), band = "simultaneous")
attr(dif$pred_df, "significant")
semipred(fit2, "race", "age", deriv = 1)$plt # growth rates
predictmeans(fit2, "race", covariate = c(age = 12))$means
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.