This function performs Box-Cox transformation on the inputted data matrix.
Usage
box(data, lambda)
Arguments
data
A numeric vector, matrix or data frame of observations. Negative data values are permitted.
lambda
The transformation to be applied to the data. If negative data values are present, lambda has to be positive.
Details
To allow for negative data values, a slightly modified version of the original Box-Cox (1964) is used here. This modified version originated from Bickel and Doksum (1981), taking the following form:
f(y) = ( sgn(y) abs(y)^(lambda) -1 ) / lambda
When negative data values are involved, the transformation parameter, code{lambda}, has to be positive in order to avoid discontinuity across zero.
Value
A numeric vector, matrix or data frame of the same dimension as data is returned.
References
Bickel, P. J. and Doksum, K. A. (1981) An Analysis of Transformations Revisited. J. Amer. Statist. Assoc.76(374), 296-311.
Box, G. E. P. and Cox, D. R. (1964) An Analysis of Transformations. J. R. Statist. Soc. B26, 211-252.
See Also
rbox
Examples
data(rituximab)
data <- exprs(rituximab)
summary(data)
# Transform data using Box-Cox with lambda=0.3
dataTrans <- box(data, 0.3)
# Reverse transform data; this should return back to the original rituximab data
summary(rbox(dataTrans, 0.3))
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(flowClust)
Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
rbind, rownames, sapply, setdiff, sort, table, tapply, union,
unique, unsplit
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
Loading required package: graph
Loading required package: RBGL
Loading required package: ellipse
Loading required package: flowViz
Loading required package: flowCore
Attaching package: 'flowCore'
The following object is masked from 'package:BiocGenerics':
normalize
Loading required package: lattice
Loading required package: mnormt
Loading required package: corpcor
Loading required package: clue
Attaching package: 'flowClust'
The following object is masked from 'package:graphics':
box
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/flowClust/box.Rd_%03d_medium.png", width=480, height=480)
> ### Name: box
> ### Title: Box-Cox Transformation
> ### Aliases: box
> ### Keywords: math
>
> ### ** Examples
>
> data(rituximab)
> data <- exprs(rituximab)
> summary(data)
FSC.H SSC.H FL1.H FL2.H
Min. : 59.0 Min. : 11.0 Min. : 0.0 Min. : 0.0
1st Qu.: 178.0 1st Qu.: 130.0 1st Qu.:197.0 1st Qu.: 55.0
Median : 249.0 Median : 199.0 Median :244.0 Median :116.0
Mean : 287.1 Mean : 251.8 Mean :349.2 Mean :126.4
3rd Qu.: 331.0 3rd Qu.: 307.0 3rd Qu.:445.0 3rd Qu.:185.0
Max. :1023.0 Max. :1023.0 Max. :974.0 Max. :705.0
FL3.H FL1.A FL1.W Time
Min. : 1.0 Min. : 0.00 Min. : 0.0 Min. : 2
1st Qu.: 150.0 1st Qu.: 0.00 1st Qu.: 0.0 1st Qu.:140
Median : 203.0 Median : 0.00 Median : 0.0 Median :285
Mean : 258.3 Mean : 73.46 Mean : 17.6 Mean :294
3rd Qu.: 315.0 3rd Qu.: 8.00 3rd Qu.: 0.0 3rd Qu.:451
Max. :1023.0 Max. :1023.00 Max. :444.0 Max. :598
> # Transform data using Box-Cox with lambda=0.3
> dataTrans <- box(data, 0.3)
> # Reverse transform data; this should return back to the original rituximab data
> summary(rbox(dataTrans, 0.3))
FSC.H SSC.H FL1.H FL2.H
Min. : 59.0 Min. : 11.0 Min. : 0.0 Min. : 0.0
1st Qu.: 178.0 1st Qu.: 130.0 1st Qu.:197.0 1st Qu.: 55.0
Median : 249.0 Median : 199.0 Median :244.0 Median :116.0
Mean : 287.1 Mean : 251.8 Mean :349.2 Mean :126.4
3rd Qu.: 331.0 3rd Qu.: 307.0 3rd Qu.:445.0 3rd Qu.:185.0
Max. :1023.0 Max. :1023.0 Max. :974.0 Max. :705.0
FL3.H FL1.A FL1.W Time
Min. : 1.0 Min. : 0.00 Min. : 0.0 Min. : 2
1st Qu.: 150.0 1st Qu.: 0.00 1st Qu.: 0.0 1st Qu.:140
Median : 203.0 Median : 0.00 Median : 0.0 Median :285
Mean : 258.3 Mean : 73.46 Mean : 17.6 Mean :294
3rd Qu.: 315.0 3rd Qu.: 8.00 3rd Qu.: 0.0 3rd Qu.:451
Max. :1023.0 Max. :1023.00 Max. :444.0 Max. :598
>
>
>
>
>
> dev.off()
null device
1
>