Variance of frequency distribution table (numerical variable)

Share:

Description

S3 methods for the variance of a fdt.
Useful to estimate the variance (when the real data vector is not known) from a previous fdt.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## S3 generic
var(x, ...)

## S3 methods: numerical
## Default S3 method:
var(x, ...)

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

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

Arguments

x

A fdt (simple or multiple) object.

...

Required to be generic.

Details

var.fdt calculates the value of the variance based on a known formula. var.fdt.multiple calls var.fdtfor each variable, that is, each column of the data.frame.

Value

var.fdt returns a numeric vector containing the value of the median of the fdt. median.fdt.multiple returns a list, where each element is a numeric vector containing the value of the variance of the fdt for each variable.

Author(s)

Jos<e9> Cl<e1>udio Faria
Enio G. Jelihovschi
Ivan B. Allaman

See Also

sd.fdt, mean.fdt.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
mdf <- data.frame(x=rnorm(1e2, 
                          20, 
                          2),
                  y=rnorm(1e2, 
                          30,
                          3),
                  z=rnorm(1e2,
                          40,
                          4))

head(mdf)

apply(mdf,
      2,
      var)

var(fdt(mdf))