var.psData {fitPS}R Documentation

An S3 method for computing the variance of clothing survey for the number of groups or size of groups

Description

An S3 method for computing the variance of clothing survey for the number of groups or size of groups

Usage

## S3 method for class 'psData'
var(x, ...)

Arguments

x

an object of class psDatareadData for more details.

...

other arguments which are passed to sum

Value

the mean of the data. If there are rir_i observations of the value nin_i then the variance is computed by E[X2]E[X]2\mathrm{E}[X^2]-\mathrm{E}[X]^2, where E[X]\mathrm{E}[X] is computed using

iri×niiri\sum_i\frac{r_i\times n_i}{\sum_i{r_i}}

, and E[X2]\mathrm{E}[X^2] is computed by

iri×ni2iri\sum_i\frac{r_i\times n_i^2}{\sum_i{r_i}}

. We realise that the computational formula, E[X2]E[X]2\mathrm{E}[X^2]-\mathrm{E}[X]^2, is usually not regarded as computationally stable, but the magnitude of the numbers involved is such that, that this is not likely to cause an issue.

Examples

data(Psurveys)
var(Psurveys$roux)

[Package fitPS version 1.0.1 Index]