Type: | Package |
Title: | Nonparametric Models for Longitudinal Data |
Version: | 1.0.0 |
Date: | 2018-02-12 |
Author: | Xin Tian, Colin Wu |
Maintainer: | Xin Tian <tianxtt@gmail.com> |
Description: | Support the book: Wu CO and Tian X (2018). Nonparametric Models for Longitudinal Data. Chapman & Hall/CRC (to appear); and provide fit for using global and local smoothing methods for the conditional-mean and conditional-distribution based models with longitudinal Data. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
BugReports: | https://github.com/npmldabook/npmlda/issues |
URL: | https://github.com/npmldabook/npmlda/ |
Encoding: | UTF-8 |
LazyData: | true |
Depends: | R (≥ 3.0) |
Imports: | splines |
RoxygenNote: | 6.0.1 |
NeedsCompilation: | no |
Packaged: | 2018-02-12 05:26:15 UTC; tianx |
Repository: | CRAN |
Date/Publication: | 2018-02-12 12:34:47 UTC |
BDIdata dataset
Description
This dataset includes 557 depressed patients (total 7117 observations) in the cognitive behavior therapy arm in the Enhancing Recovery in Coronary Heart Disease Patients (ENRICHD) study.
Usage
data(BDIdata)
Format
A data frame with 7117 rows and 5 variables.
Details
ID. Subject ID
time. Study visit time (in days) since randomization
BDI. Beck Depression Inventory (BDI) score
med. Antidepressant medication use
med.time. The starting time of medication
References
Wu, C. O., Tian, X. and Bang, H. A varying-coefficient model for the evaluation of time-varying concomitant intervention effects in longitudinal studies. Statistics in Medicine, 27:3042-3056, 2008.
Wu, C. O., Tian, X. and Jiang, W. A shared parameter model for the estimation of longitudinal concomitant intervention effects Biostatistics, 12(4):737-749, 2011.
BMACS CD4 dataset
Description
This dataset is from the Baltimore site of the Multi-center AIDS Cohort Study (BMACS), which included 400 homosexual men who were infected by the human immunodeficiency virus (HIV) between 1984 and 1991.
Usage
data(BMACS)
Format
A data frame with 1817 rows and 6 variables.
Details
ID. Subject ID
Time. Subject's study visit time
Smoke. Cigarette baseline smoking status
age. Age at study enrollment
preCD4. Pre-infection CD4 percentage
CD4. CD4 percentage at the time of visit
References
Kaslow, R. A., Ostrow, D. G., Detels, R., Phair, J. P., Polk, B. F. and Rinaldo, C. R. The Multicenter AIDS Cohort Study: rationale, organization and selected characteristics of the participants. American Journal of Epidemiology, 126:310-318, 1987.
Leave one-subject cross-validation score for local linear fit
Description
Leave one-subject cross-validation score for local linear fit
Usage
CVlm(Xvec, Yvec, bw, ID, Wt)
Arguments
Xvec , Yvec |
numeric vectors of data values, Xvec and Yvec must have the same length. |
bw |
a bandwidth of the Epanechnikov kernel |
ID |
subject ID of the data value |
Wt |
a weight vector, may be subject-specific. a weight vector or a constant. For longitudinal data, Wt=1/N corresponds to measurement uniform weight and Wt=1/(nni) corresponds subject uniform weight. |
Leave one-subject cross-validation score for spline fit
Description
Leave one-subject cross-validation score for spline fit
Usage
CVspline(Xvec, Yvec, ID, nKnots, Degree, Wt)
Arguments
Xvec , Yvec |
numeric vectors of data values, Xvec and Yvec must have the same length. |
ID |
subject ID of the data value |
nKnots |
number of equally-spaced knots |
Degree |
degree of polynomial splines |
Wt |
a weight vector. For longitudinal data, Wt=1/N corresponds to measurement uniform weight and Wt=1/(nni) corresponds subject uniform weight. |
References
Wu, C.O. and Tian, X. Nonparametric Models for Longitudinal Data. Chapman & Hall/CRC. To appear.
HSCT dataset
Description
This dataset consists of 20 patients with hematologicmalignancies who had allogeneic hematopoietic stem cell transplantation (HSCT) between 2006 and 2009 at the National Institutes of Health (NIH). The variables are as follows:
Usage
data(HSCT)
Format
A data frame with 271 rows and 8 variables.
Details
ID. Subject ID
Days. Subject's study visit time relative to time of transplant (day 0)
Granu. Granulocytes (K/uL)
LYM. Lymphocytes (K/uL)
MON. Monocytes (K/uL)
G-CSF. Granulocyte colony-stimulating factor level (pg/mL)
IL-15. IL-15 level (pg/mL)
MCP-1. monocyte chemotactic protein-1 level (pg/mL)
References
Melenhorst, J.J., Tian, X., Xu, D., Sandler, N.G., Scheinberg, P., Biancotto, A., et al. Cytopenia and leukocyte recovery shape cytokine fluctuations after myeloablative allogeneic hematopoietic stem cell transplantation. Haematologica, 97(6):867-73, 2012.
Biweight kernel
Description
Biweight kernel
Usage
Kh.Bw(datavec, Bndwdth)
Arguments
datavec |
a numeric vector |
Bndwdth |
a bandwidth of the kernel |
Value
kernel function result
Examples
# same usage as Kh.Ep
Epanechnikov Kernel
Description
Epanechnikov Kernel
Usage
Kh.Ep(datavec, Bndwdth)
Arguments
datavec |
a numeric vector |
Bndwdth |
a bandwidth |
Value
kernel function result
Examples
Kh.Ep(2:7,5)
Normal kernel
Description
Normal kernel
Usage
Kh.Nm(datavec, Bndwdth)
Arguments
datavec |
a numeric vector |
Bndwdth |
a bandwidth of the kernel |
Value
kernel function result
Examples
Kh.Nm(2:7,5)
Local linear fit with Epanechnikov kernel
Description
Local linear fit with Epanechnikov kernel
Usage
LocalLm(Xint, Xvec, Yvec, bw, Wt = 1)
Arguments
Xint |
a vector of x interval to generate the local linear fit |
Xvec , Yvec |
numeric vectors of data values, Xvec and Yvec must have the same length. |
bw |
a bandwidth of the kernel |
Wt |
a weight vector |
Examples
data(BMACS)
Time.int<- seq(0.1,5.9, by=0.1)
LocalFit.Y <- with(BMACS, LocalLm(Time.int, Time, CD4, bw=0.9, Wt=1))
Local linear fit at X0 with Epanechnikov kernel
Description
Local linear fit at X0 with Epanechnikov kernel
Usage
LocalLm.X0(Xvec, Yvec, X0, Bndwdth, Wt = 1)
Arguments
Xvec , Yvec |
numeric vectors of data values, Xvec and Yvec must have the same length. |
X0 |
a given value |
Bndwdth |
a bandwidth of the kernel |
Wt |
a weight vector or a constant. For longitudinal data, Wt=1/N corresponds to measurement uniform weight and Wt=1/(nni) corresponds subject uniform weight. |
Examples
# see usage of LocalLm
Title Nadaraya-Watson Kernel estimator at x0
Description
Title Nadaraya-Watson Kernel estimator at x0
Usage
NW.WtKernel(Xvec, Yvec, X0, Kernel = "Ep", Bndwdth, Wt = 1)
Arguments
Xvec , Yvec |
numeric vectors of data values, Xvec and Yvec must have the same length. |
X0 |
a given value |
Kernel |
a character string indicating which kernel function is to be used. Use of "Ep", "Bw", or "Nm" for Epanechnikov, Biweight or Normal kernel function. |
Bndwdth |
a bandwidth of the kernel |
Wt |
a weight vector or a constant. For longitudinal data, Wt=1/N corresponds to measurement uniform weight and Wt=1/(nni) corresponds subject uniform weight. |
Value
The kernel estimator at x0
References
Fan, J. and Gijbels, I. Local Polynomial Modeling and Its Applications. Chapman & Hall, London, United Kingdom, 1996.
Wu, C.O. and Tian, X. Nonparametric Models for Longitudinal Data. Chapman & Hall/CRC. To appear.
Examples
X <- seq(0, 1, len=100)
Y <- (X- 0.5)^3 - 2*(X-0.5)^2+ rnorm(100, 0, 0.1)
NW.WtKernel(X, Y, X0=0.5, Kernel="Ep", Bndwdth=0.3, Wt=1 )
NW.WtKernel(X, Y, X0=0.5, Kernel="Nm", Bndwdth=0.3, Wt=1 )
Polynomial-spline fit with equally-spaced knots
Description
Polynomial-spline fit with equally-spaced knots
Usage
Spline.fit(Xint, Xvec, Yvec, nKnots = 2, Degree = 3, Wt = 1)
Arguments
Xint |
a vector of x interval to generate the local linear fit |
Xvec , Yvec |
numeric vectors of data values, Xvec and Yvec must have the same length. |
nKnots |
number of equally-spaced knots |
Degree |
degree of polynomial splines |
Wt |
a weight vector or a constant. For longitudinal data, Wt=1/N corresponds to measurement uniform weight and Wt=1/(nni) corresponds subject uniform weight. |
References
Wu, C.O. and Tian, X. Nonparametric Models for Longitudinal Data. Chapman & Hall/CRC. To appear.
Nadaraya-Watson Kernel estimator
Description
Nadaraya-Watson Kernel estimator
Usage
kernel.fit(Xint, Xvec, Yvec, bw, Kernel = "Ep", Wt = 1)
Arguments
Xint |
a vector of x interval to generate the local linear fit |
Xvec , Yvec |
numeric vectors of data values, Xvec and Yvec must have the same length. |
bw |
a bandwidth of the kernel |
Kernel |
a character string indicating which kernel function is to be used. Use of "Ep", "Bw", or "Nm" for Epanechnikov, Biweight or Normal kernel function. |
Wt |
a weight vector |
References
Fan, J. and Gijbels, I. Local Polynomial Modeling and Its Applications. Chapman & Hall, London, United Kingdom, 1996.
Wu, C.O. and Tian, X. Nonparametric Models for Longitudinal Data. Chapman & Hall/CRC. To appear.
Examples
X <- seq(0, 1, len=100)
Y <- (X- 0.5)^3 - 2*(X-0.5)^2+ rnorm(100, 0, 0.1)
kernel.fit(seq(0,1,0.1), X, Y, Kernel="Ep", bw=0.1, Wt=1 )