bootstrapVar: A boostap method to calculate the standard error of the...

View source: R/bootstrapVar.R

bootstrapVarR Documentation

A boostap method to calculate the standard error of the variance

Description

This function uses the bootrstap method to calculate the uncertainty of the variance of a given sample based on random resampling. The number of the resamples is a parameter (default is 1000). Given that the resampling methods underestimate the uncertainty and thus provide a biased estimation, we offer the the unbiased method as a default, although the user may change this option through the biased parameter for experimental purposes (they are strongly advised not to do for real problems with small samples).

Usage

bootstrapVar(data, nrep = 1000, biased = FALSE)

Arguments

data

The input data in the form of a vector. NA values are omitted.

nrep

The number of bootstrap resamples. Default is 1000. The higher the number of the samples, the better the bootstrap outcome.

biased

A logical parameter to indicate if the user wants the biased version. Resampling techniques always underestimate statistics like the variance or the standard error of it for small samples.

Value

The standard error of the variance of data and the mean of the bootsrap samples means.

Examples

# size of the sample
n=50
#generate a random sample of size n from a normal distribution
data_ex=rnorm(n,0.5,0.1)
bootstrapVar(data)

mouseData=readHeteroplasmyData("HB")
mouseData1 = mouseData[which(!is.na(mouseData[,1])),1]
bootstrapVar(mouseData1)

# use the package data and load it to variable mouseData
mouseData=mousedataLE
# calculate the standard error of the variance for the LE oocyte sample #3
bootstrapVar(mouseData[,3])

kostasgian21/heteroplasmy documentation built on Jan. 30, 2024, 12:30 a.m.