Description Usage Arguments References Examples
Least square local linear fit
1 | LocalLm.Beta(Tint, Tvec, X1, X2, X3, Yvec, Bndwdth, Weight)
|
Tint |
a time interval |
Tvec, Yvec |
numeric vectors of time and outcome values, Tvec and Yvec must have the same length. |
X1, X2, X3 |
three covariate vectors |
Bndwdth |
a bandwidth of the Epanechnikov kernel |
Weight |
the weight vector |
Wu, C.O. and Tian, X. Nonparametric Models for Longitudinal Data: With Implementation in R. Chapman & Hall/CRC. 2018.
1 2 3 4 5 6 7 8 9 10 11 | data(NGHS)
NGHS$Black <- (NGHS$RACE==2)*1
NGHS<- NGHS[!is.na(NGHS$SBP) & !is.na(NGHS$BMIPCT) & !is.na(NGHS$HTPCT ),]
Ct <- data.frame(table(NGHS$ID))
names(Ct)<- c('ID', 'ni')
NGHS<- merge(NGHS, Ct, by= 'ID')
nID<- dim(Ct)[1]
Age.grid <- seq(9, 19, by=0.5) #21
NGHS$HTPCTc<- NGHS$HTPCT-50
NGHS$BMIPCTc<- NGHS$BMIPCT-50
Beta <- with(NGHS, LocalLm.Beta(Age.grid, AGE, X1=Black, X2=HTPCTc, X3=BMIPCTc, SBP, Bndwdth=3.5, Weight=1/ni))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.