LocalLm.Beta: Least square local linear fit

Description Usage Arguments References Examples

Description

Least square local linear fit

Usage

1
LocalLm.Beta(Tint, Tvec, X1, X2, X3, Yvec, Bndwdth, Weight)

Arguments

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

References

Wu, C.O. and Tian, X. Nonparametric Models for Longitudinal Data: With Implementation in R. Chapman & Hall/CRC. 2018.

Examples

 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))

npmldabook/npmlda documentation built on May 25, 2019, 10:41 p.m.