imputeMissing: Impute missing copy number values

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/imputeMissing.R

Description

Missing copy number values are imputed by a constant value or pcf-estimates.

Usage

1
imputeMissing(data, method, c = 0, pcf.est = NULL,...)

Arguments

data

a data frame with numeric or character chromosome numbers in the first column, numeric local probe positions in the second, and numeric copy number data for one or more samples in subsequent columns.

method

the imputation method to be used. Must be one of "constant" and "pcf".

c

a numerical value to be imputed if method is "constant". Default is 0.

pcf.est

a data frame of same size as data, with chromosome numbers and positions in the first two columns, and copy number estimates obtained from pcf in the subsequent columns. Only applicable if method="pcf". If unspecified and method="pcf", pcf is run internally to find estimates.

...

other relevant parameters to be passed on to pcf

Details

The available imputation methods are:

constant:

all missing values in data are replaced by the specified value c.

pcf:

the estimates from pcf-segmentation (see pcf) are used to impute missing values. If pcf has already been run, these estimates may be specified in pcf.est. If pcf.est is unspecified, pcf is run on the input data. In pcf the analysis is done on the observed values, and estimates for missing observations are set to be the estimate of the nearest observed probe.

Value

A data frame of the same size and format as data with all missing values imputed.

Author(s)

Gro Nilsen

See Also

pcf

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#Load lymphoma data
data(lymphoma)
chrom <- lymphoma[,1]
pos <- lymphoma[,2]
#pick out data for the first six samples:
cn.data <- lymphoma[,3:8]

#Create missing values in cn.data at random positions:
n <- nrow(cn.data)*ncol(cn.data)
r <- matrix(rbinom(n=n,size=1,prob=0.95),nrow=nrow(cn.data),ncol=ncol(cn.data))
cn.data[r==0] <- NA    #matrix with approximately 5% missing values
mis.data <- data.frame(chrom,pos,cn.data)

#Impute missing values by constant, c=0:
imp.data <- imputeMissing(data=mis.data,method="constant")

#Impute missing values by obtained pcf-values:
pcf.est <- pcf(data=mis.data,return.est=TRUE)
imp.data <- imputeMissing(data=mis.data,method="pcf",pcf.est=pcf.est)

#Or run pcf within imputeMissing:
imp.data <- imputeMissing(data=mis.data,method="pcf")

copynumber documentation built on Nov. 8, 2020, 6:10 p.m.