# plotNIRS: NIRS Time Series Visualization In NIRStat: Novel Statistical Methods for Studying Near-Infrared Spectroscopy (NIRS) Time Series Data

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