CytoDx.pred: Make prediction using the CytoDx model

Description Usage Arguments Value Examples

Description

A function that makes prediction using the CytoDx model.

Usage

1
CytoDx.pred(fit, xNew, xSampleNew)

Arguments

fit

The two stage statistical model. Must be the object returned by CytoDx.fit.

xNew

The marker profile of cells pooled from all new samples. Each row is a cell, each column is a marker.

xSampleNew

A vector specifying which sample each cell belongs to. Length must equal to nrow(xNew).

Value

Returns a list. xNew.Pred1 contains the predicted y for the new data at the cell level. xNew.Pred2 contains the predicted y for the new data at the sample level.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Find the table containing fcs file names in CytoDx package
path <- system.file("extdata",package="CytoDx")
# read the table
fcs_info <- read.csv(file.path(path,"fcs_info.csv"))
# Specify the path to the cytometry files
fn <- file.path(path,fcs_info$fcsName)
train_data <- fcs2DF(fcsFiles=fn,
                    y=fcs_info$Label,
                    assay="FCM",
                    b=1/150,
                    excludeTransformParameters=
                      c("FSC-A","FSC-W","FSC-H","Time"))
# build the model
fit <- CytoDx.fit(x=as.matrix(train_data[,1:7]),
                y=train_data$y,
                xSample = train_data$xSample,
                reg=FALSE,
                family="binomial")
# check accuracy for training data
pred <- CytoDx.pred(fit,
                   xNew=as.matrix(train_data[,1:7]),
                   xSampleNew=train_data$xSample)

boxplot(pred$xNew.Pred.sample$y.Pred.s0~
          fcs_info$Label)

hzc363/CytoDx documentation built on May 8, 2019, 11:56 p.m.