convert.moments: Convert Statistical Moments

Description Usage Arguments Details Examples

View source: R/find_moments.R

Description

Transform the raw, central or normalized statistical moments between them.

Usage

1
2
convert.moments(data, from = c("raw", "central", "normalized"),
  to = c("raw", "central", "normalized"), eta = NULL)

Arguments

data

data.frame containing statistical moments.

from

What type of statistical moments do we have in input data? Three types of moments are accepted: "raw", "central", "normalized".

to

What type of statistical moments do you want to obtain? Three types of moments can be obtained: "raw", "central", "normalized".

eta

A numeric vector of the expected values. This is required ONLY is we convert central moments into raw or normalized. Default: NULL.

Details

Wikipedia: In probability theory and statistics, the standardized moment of a probability distribution is a moment (normally a higher degree central moment) that is normalized. The normalization is typically a division by an expression of the standard deviation which renders the moment scale invariant. This has the advantage that such normalized moments differ only in other properties than variability, facilitating e.g. comparison of shape of different probability distributions.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# raw moments
RM <- c(1, 68.75099, 4991.724, 371531.9, 28199680,  
        2176435499, 170477697491)

CM1 <- convert.moments(RM, from = "raw", to = "central")    # raw to central
NM1 <- convert.moments(RM, from = "raw", to = "normalized") # raw to normalized

CM2 <- convert.moments(NM1, from = "normalized", to = "central")
RM2 <- convert.moments(NM1, from = "normalized", to = "raw")

RM3 <- convert.moments(CM2, from = "central", to = "raw", eta = 68.75099)
NM3 <- convert.moments(CM2, from = "central", to = "normalized", eta = 68.75099)

# The resulted error following multiple conversions is negligible
sum(RM - RM3)

mpascariu/MortalityForecast documentation built on Sept. 28, 2020, 2:40 p.m.