gate_singlet: Creates a singlet polygon gate using the prediction bands...

View source: R/singletGate.R

gate_singletR Documentation

Creates a singlet polygon gate using the prediction bands from a robust linear model

Description

We construct a singlet gate by applying a robust linear model with rlm. By default, we model the forward-scatter height (FSC-H)as a function of forward-scatter area (FSC-A). If sidescatter is given, forward-scatter height is as a function of area + sidescatter + sidescatter / area.

Usage

gate_singlet(
  x,
  area = "FSC-A",
  height = "FSC-H",
  sidescatter = NULL,
  prediction_level = 0.99,
  subsample_pct = NULL,
  wider_gate = FALSE,
  filterId = "singlet",
  maxit = 5,
  ...
)

singletGate(
  x,
  area = "FSC-A",
  height = "FSC-H",
  sidescatter = NULL,
  prediction_level = 0.99,
  subsample_pct = NULL,
  wider_gate = FALSE,
  filterId = "singlet",
  maxit = 5,
  ...
)

Arguments

x

a flowFrame object

area

character giving the channel name that records the signal intensity as peak area

height

character giving the channel name that records the signal intensity as peak heightchannel name of height

sidescatter

character giving an optional channel name for the sidescatter signal. By default, ignored.

prediction_level

a numeric value between 0 and 1 specifying the level to use for the prediction bands

subsample_pct

a numeric value between 0 and 1 indicating the percentage of observations that should be randomly selected from x to construct the gate. By default, no subsampling is performed.

wider_gate

logical value. If TRUE, the prediction bands used to construct the singlet gate use the robust fitted weights, which increase prediction uncertainty, especially for large FSC-A. This leads to wider gates, which are sometimes desired.

filterId

the name for the filter that is returned

maxit

the limit on the number of IWLS iterations passed to rlm

...

additional arguments passed to rlm

Details

Because rlm relies on iteratively reweighted least squares (IRLS), the runtime to construct a singlet gate is dependent in part on the number of observations in x. To improve the runtime, we provide an option to subsample randomly a subset of x. A percentage of observations to subsample can be given in subsample_pct. By default, no subsampling is applied.

Value

a polygonGate object with the singlet gate

Examples

## Not run: 
 # fr is a flowFrame
 sg <- gate_singlet(fr, area = "FSC-A", height = "FSC-H")
 sg
 # plot the gate 
 xyplot(`FSC-H` ~ `FSC-A`, fr, filter = sg)

## End(Not run)

RGLab/flowStats documentation built on July 20, 2023, 1:33 a.m.