plotNIRS: NIRS Time Series Visualization

Description Usage Arguments Details Author(s) Examples

View source: R/plotNIRS.R

Description

This function visualizes the NIRS time series data and estimates the underlying smoothed trend of the NRIS based on a nonparametric regression approach.

Usage

1
plotNIRS(Yvec,timevec,transfusionvec)

Arguments

Yvec

The outcome of NIRS time series Y(t_{i}) of length N ranging from 15 to 100.

timevec

The time index of NIRS time series t_{i} of length N.

transfusionvec

The 0/1 indicator of the transfusion status X(t_{i}). X(t_{i})=0 means the current time point is before transfusion and X(t_{i})=1 means the current time point is after transfusion.

Details

This function visualizes the NIRS time series data before and after transfusion. In order to estimate the underlying smoothed curve, it first imputes the data with detection limit (DL) and utilizes a nonparametric regression approach for the imputed data. The time points with DL is in red and others are in black.

Author(s)

Yikai Wang [Emory], Xiao Wang [ICF]
Maintainer: Yikai Wang johnzon.wyk@gmail.com

Examples

1
2
3
4
5
6
7
8
9
# Data Simulation
dat = data.frame(Y= rep(0,200),t=1:200,trans = c(rep(0,100),rep(1,100)))
dat$Y = apply(dat,1,function(x){rnorm(1,5*rnorm(1),6*exp(rnorm(1)))})
dat$Y = dat$Y + 15 - quantile(dat$Y,0.3) 
dat$Y[dat$Y<=15] = 15


# Visualize the NIRS time series before and after transfusion. 
plotNIRS(dat$Y,dat$t,dat$trans)

Example output

Loading required package: ggplot2
Loading required package: mgcv
Loading required package: nlme
This is mgcv 1.8-33. For overview type 'help("mgcv-package")'.
Loading required package: gridExtra
`geom_smooth()` using method = 'loess' and formula 'y ~ x'
`geom_smooth()` using method = 'loess' and formula 'y ~ x'
Warning messages:
1: Removed 3 rows containing non-finite values (stat_smooth). 
2: Removed 3 rows containing missing values (geom_point). 

NIRStat documentation built on July 1, 2020, 10:37 p.m.

Related to plotNIRS in NIRStat...