Title: | Unbiased Central Moment Estimates |
---|---|
Description: | Calculates one-sample unbiased central moment estimates and two-sample pooled estimates up to 6th order, including estimates of powers and products of central moments. Provides the machinery for obtaining unbiased central moment estimators beyond 6th order by generating expressions for expectations of raw sample moments and their powers and products. Gerlovina and Hubbard (2019) <doi:10.1080/25742558.2019.1701917>. |
Authors: | Inna Gerlovina [aut, cre], Alan Hubbard [aut] |
Maintainer: | Inna Gerlovina <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0.1 |
Built: | 2025-02-16 02:44:53 UTC |
Source: | https://github.com/innager/umoments |
Generate a string with symbolic expression for expectation of powers and products of non-central (raw) sample moments of an arbitrary order.
one_combination(powvect, smpsize = "n")
one_combination(powvect, smpsize = "n")
powvect |
vector of non-negative integers representing exponents
|
smpsize |
symbol to be used for sample size. Defaults to |
For a zero-mean random variable X
and a sample , find
, where
is a
'th
non-central sample moment. The expression is given in terms of sample size
and true moments
of
. These expectations can
subsequently be used for generating unbiased central moment estimators of an
arbitrary order, Edgeworth expansions, and possibly solving other
higher-order problems.
A string representing a symbolic expression for further processing using computer algebra (e.g. with Sage or SymPy), for calculating numeric values, or to be rendered with Latex.
one_combination(c(5, 0, 2, 1))
one_combination(c(5, 0, 2, 1))
Calculate unbiased estimates of central moments and their powers and products up to specified order.
uM(smp, order)
uM(smp, order)
smp |
sample. |
order |
highest order of the estimates to calclulate. Estimates of lower orders will be included. |
Unbiased estimates up to the 6th order can be calculated. Second and third
orders contain estimates of the variance and third central moment, fourth
order includes estimates of fourth moment and squared variance
(), fifth order - of fifth moment and a product of
second and third moments (
), sixth order - of
sixth moment, a product of second and fourth moments (
), squared third moment (
), and
cubed variance (
).
A named vector of estimates of central moments and their powers and
products up to order
. The highest order available is 6th. The names
of the elements are "M2", "M3", "M4", "M5", "M6"
for corresponding
central moments, "M2M3", "M2M4"
for products of the moments (second
and third, second and fourth), and "M2pow2", "M2pow3", "M3pow2"
for
powers of the moments - corresponding to estimates of squared variance,
cubed variance, and squared third moment.
Gerlovina, I. and Hubbard, A.E. (2019). Computer algebra and algorithms for unbiased moment estimation of arbitrary order. Cogent Mathematics & Statistics, 6(1).
uMpool
for two-sample pooled estimates.
smp <- rgamma(10, shape = 3) uM(smp, 6)
smp <- rgamma(10, shape = 3) uM(smp, 6)
Calculate unbiased estimates of central moments and their powers and products.
uM2(m2, n)
uM2(m2, n)
m2 |
naive biased variance estimate |
n |
sample size. |
Unbiased variance estimate.
Other unbiased estimates (one-sample):
uM2M3()
,
uM2M4()
,
uM2pow2()
,
uM2pow3()
,
uM3()
,
uM3pow2()
,
uM4()
,
uM5()
,
uM6()
n <- 10 smp <- rgamma(n, shape = 3) m <- mean(smp) m <- c(m, mean((smp - m[1])^2)) uM2(m[2], n) - var(smp)
n <- 10 smp <- rgamma(n, shape = 3) m <- mean(smp) m <- c(m, mean((smp - m[1])^2)) uM2(m[2], n) - var(smp)
Calculate unbiased estimates of central moments and their powers and products.
uM2M3(m2, m3, m5, n)
uM2M3(m2, m3, m5, n)
m2 |
naive biased variance estimate |
m3 |
naive biased third central moment estimate |
m5 |
naive biased fifth central moment estimate |
n |
sample size. |
Unbiased estimate of a product of second and third central moments
, where
and
are second and third central moments respectively.
Other unbiased estimates (one-sample):
uM2()
,
uM2M4()
,
uM2pow2()
,
uM2pow3()
,
uM3()
,
uM3pow2()
,
uM4()
,
uM5()
,
uM6()
n <- 10 smp <- rgamma(n, shape = 3) m <- mean(smp) for (j in 2:5) { m <- c(m, mean((smp - m[1])^j)) } uM2M3(m[2], m[3], m[5], n)
n <- 10 smp <- rgamma(n, shape = 3) m <- mean(smp) for (j in 2:5) { m <- c(m, mean((smp - m[1])^j)) } uM2M3(m[2], m[3], m[5], n)
Calculate pooled unbiased estimates of central moments and their powers and products.
uM2M3pool(m2, m3, m5, n_x, n_y)
uM2M3pool(m2, m3, m5, n_x, n_y)
m2 |
naive biased variance estimate |
m3 |
naive biased third central moment estimate |
m5 |
naive biased fifth central moment estimate |
n_x |
number of observations in the first group. |
n_y |
number of observations in the second group. |
Pooled estimate of a product of second and third central moments
, where
and
are second and third central moments respectively.
Other pooled estimates (two-sample):
uM2M4pool()
,
uM2pool()
,
uM2pow2pool()
,
uM2pow3pool()
,
uM3pool()
,
uM3pow2pool()
,
uM4pool()
,
uM5pool()
,
uM6pool()
nx <- 10 ny <- 8 shp <- 3 smpx <- rgamma(nx, shape = shp) - shp smpy <- rgamma(ny, shape = shp) mx <- mean(smpx) my <- mean(smpy) m <- numeric(5) for (j in 2:5) { m[j] <- mean(c((smpx - mx)^j, (smpy - my)^j)) } uM2M3pool(m[2], m[3], m[5], nx, ny)
nx <- 10 ny <- 8 shp <- 3 smpx <- rgamma(nx, shape = shp) - shp smpy <- rgamma(ny, shape = shp) mx <- mean(smpx) my <- mean(smpy) m <- numeric(5) for (j in 2:5) { m[j] <- mean(c((smpx - mx)^j, (smpy - my)^j)) } uM2M3pool(m[2], m[3], m[5], nx, ny)
Calculate unbiased estimates of central moments and their powers and products.
uM2M4(m2, m3, m4, m6, n)
uM2M4(m2, m3, m4, m6, n)
m2 |
naive biased variance estimate |
m3 |
naive biased third central moment estimate |
m4 |
naive biased fourth central moment estimate |
m6 |
naive biased sixth central moment estimate |
n |
sample size. |
Unbiased estimate of a product of second and fourth central moments
, where
and
are second and fourth central moments respectively.
Other unbiased estimates (one-sample):
uM2()
,
uM2M3()
,
uM2pow2()
,
uM2pow3()
,
uM3()
,
uM3pow2()
,
uM4()
,
uM5()
,
uM6()
n <- 10 smp <- rgamma(n, shape = 3) m <- mean(smp) for (j in 2:6) { m <- c(m, mean((smp - m[1])^j)) } uM2M4(m[2], m[3], m[4], m[6], n)
n <- 10 smp <- rgamma(n, shape = 3) m <- mean(smp) for (j in 2:6) { m <- c(m, mean((smp - m[1])^j)) } uM2M4(m[2], m[3], m[4], m[6], n)
Calculate pooled unbiased estimates of central moments and their powers and products.
uM2M4pool(m2, m3, m4, m6, n_x, n_y)
uM2M4pool(m2, m3, m4, m6, n_x, n_y)
m2 |
naive biased variance estimate |
m3 |
naive biased third central moment estimate |
m4 |
naive biased fourth central moment estimate |
m6 |
naive biased sixth central moment estimate |
n_x |
number of observations in the first group. |
n_y |
number of observations in the second group. |
Pooled estimate of a product of second and fourth central moments
, where
and
are second and fourth central moments respectively.
Other pooled estimates (two-sample):
uM2M3pool()
,
uM2pool()
,
uM2pow2pool()
,
uM2pow3pool()
,
uM3pool()
,
uM3pow2pool()
,
uM4pool()
,
uM5pool()
,
uM6pool()
nx <- 10 ny <- 8 shp <- 3 smpx <- rgamma(nx, shape = shp) - shp smpy <- rgamma(ny, shape = shp) mx <- mean(smpx) my <- mean(smpy) m <- numeric(6) for (j in 2:6) { m[j] <- mean(c((smpx - mx)^j, (smpy - my)^j)) } uM2M4pool(m[2], m[3], m[4], m[6], nx, ny)
nx <- 10 ny <- 8 shp <- 3 smpx <- rgamma(nx, shape = shp) - shp smpy <- rgamma(ny, shape = shp) mx <- mean(smpx) my <- mean(smpy) m <- numeric(6) for (j in 2:6) { m[j] <- mean(c((smpx - mx)^j, (smpy - my)^j)) } uM2M4pool(m[2], m[3], m[4], m[6], nx, ny)
Calculate pooled unbiased estimates of central moments and their powers and products.
uM2pool(m2, n_x, n_y)
uM2pool(m2, n_x, n_y)
m2 |
naive biased variance estimate |
n_x |
number of observations in the first group. |
n_y |
number of observations in the second group. |
Pooled variance estimate.
Other pooled estimates (two-sample):
uM2M3pool()
,
uM2M4pool()
,
uM2pow2pool()
,
uM2pow3pool()
,
uM3pool()
,
uM3pow2pool()
,
uM4pool()
,
uM5pool()
,
uM6pool()
nx <- 10 ny <- 8 shp <- 3 smpx <- rgamma(nx, shape = shp) - shp smpy <- rgamma(ny, shape = shp) m2 <- mean(c((smpx - mean(smpx))^2, (smpy - mean(smpy))^2)) uM2pool(m2, nx, ny)
nx <- 10 ny <- 8 shp <- 3 smpx <- rgamma(nx, shape = shp) - shp smpy <- rgamma(ny, shape = shp) m2 <- mean(c((smpx - mean(smpx))^2, (smpy - mean(smpy))^2)) uM2pool(m2, nx, ny)
Calculate unbiased estimates of central moments and their powers and products.
uM2pow2(m2, m4, n)
uM2pow2(m2, m4, n)
m2 |
naive biased variance estimate |
m4 |
naive biased fourth central moment estimate |
n |
sample size. |
Unbiased estimate of squared variance , where
is a variance.
Other unbiased estimates (one-sample):
uM2()
,
uM2M3()
,
uM2M4()
,
uM2pow3()
,
uM3()
,
uM3pow2()
,
uM4()
,
uM5()
,
uM6()
n <- 10 smp <- rgamma(n, shape = 3) m <- mean(smp) for (j in 2:4) { m <- c(m, mean((smp - m[1])^j)) } uM2pow2(m[2], m[4], n)
n <- 10 smp <- rgamma(n, shape = 3) m <- mean(smp) for (j in 2:4) { m <- c(m, mean((smp - m[1])^j)) } uM2pow2(m[2], m[4], n)
Calculate pooled unbiased estimates of central moments and their powers and products.
uM2pow2pool(m2, m4, n_x, n_y)
uM2pow2pool(m2, m4, n_x, n_y)
m2 |
naive biased variance estimate |
m4 |
naive biased fourth central moment estimate |
n_x |
number of observations in the first group. |
n_y |
number of observations in the second group. |
Pooled estimate of squared variance , where
is a variance.
Other pooled estimates (two-sample):
uM2M3pool()
,
uM2M4pool()
,
uM2pool()
,
uM2pow3pool()
,
uM3pool()
,
uM3pow2pool()
,
uM4pool()
,
uM5pool()
,
uM6pool()
nx <- 10 ny <- 8 shp <- 3 smpx <- rgamma(nx, shape = shp) - shp smpy <- rgamma(ny, shape = shp) mx <- mean(smpx) my <- mean(smpy) m <- numeric(4) for (j in 2:4) { m[j] <- mean(c((smpx - mx)^j, (smpy - my)^j)) } uM2pow2pool(m[2], m[4], nx, ny)
nx <- 10 ny <- 8 shp <- 3 smpx <- rgamma(nx, shape = shp) - shp smpy <- rgamma(ny, shape = shp) mx <- mean(smpx) my <- mean(smpy) m <- numeric(4) for (j in 2:4) { m[j] <- mean(c((smpx - mx)^j, (smpy - my)^j)) } uM2pow2pool(m[2], m[4], nx, ny)
Calculate unbiased estimates of central moments and their powers and products.
uM2pow3(m2, m3, m4, m6, n)
uM2pow3(m2, m3, m4, m6, n)
m2 |
naive biased variance estimate |
m3 |
naive biased third central moment estimate |
m4 |
naive biased fourth central moment estimate |
m6 |
naive biased sixth central moment estimate |
n |
sample size. |
Unbiased estimate of cubed second central moment
, where
is a variance.
Other unbiased estimates (one-sample):
uM2()
,
uM2M3()
,
uM2M4()
,
uM2pow2()
,
uM3()
,
uM3pow2()
,
uM4()
,
uM5()
,
uM6()
n <- 10 smp <- rgamma(n, shape = 3) m <- mean(smp) for (j in 2:6) { m <- c(m, mean((smp - m[1])^j)) } uM2pow3(m[2], m[3], m[4], m[6], n)
n <- 10 smp <- rgamma(n, shape = 3) m <- mean(smp) for (j in 2:6) { m <- c(m, mean((smp - m[1])^j)) } uM2pow3(m[2], m[3], m[4], m[6], n)
Calculate pooled unbiased estimates of central moments and their powers and products.
uM2pow3pool(m2, m3, m4, m6, n_x, n_y)
uM2pow3pool(m2, m3, m4, m6, n_x, n_y)
m2 |
naive biased variance estimate |
m3 |
naive biased third central moment estimate |
m4 |
naive biased fourth central moment estimate |
m6 |
naive biased sixth central moment estimate |
n_x |
number of observations in the first group. |
n_y |
number of observations in the second group. |
Pooled estimate of cubed variance central moment
, where
is a variance.
Other pooled estimates (two-sample):
uM2M3pool()
,
uM2M4pool()
,
uM2pool()
,
uM2pow2pool()
,
uM3pool()
,
uM3pow2pool()
,
uM4pool()
,
uM5pool()
,
uM6pool()
nx <- 10 ny <- 8 shp <- 3 smpx <- rgamma(nx, shape = shp) - shp smpy <- rgamma(ny, shape = shp) mx <- mean(smpx) my <- mean(smpy) m <- numeric(6) for (j in 2:6) { m[j] <- mean(c((smpx - mx)^j, (smpy - my)^j)) } uM2pow3pool(m[2], m[3], m[4], m[6], nx, ny)
nx <- 10 ny <- 8 shp <- 3 smpx <- rgamma(nx, shape = shp) - shp smpy <- rgamma(ny, shape = shp) mx <- mean(smpx) my <- mean(smpy) m <- numeric(6) for (j in 2:6) { m[j] <- mean(c((smpx - mx)^j, (smpy - my)^j)) } uM2pow3pool(m[2], m[3], m[4], m[6], nx, ny)
Calculate unbiased estimates of central moments and their powers and products.
uM3(m3, n)
uM3(m3, n)
m3 |
naive biased third central moment estimate |
n |
sample size. |
Unbiased estimate of a third central moment.
Other unbiased estimates (one-sample):
uM2()
,
uM2M3()
,
uM2M4()
,
uM2pow2()
,
uM2pow3()
,
uM3pow2()
,
uM4()
,
uM5()
,
uM6()
n <- 10 smp <- rgamma(n, shape = 3) m <- mean(smp) for (j in 2:3) { m <- c(m, mean((smp - m[1])^j)) } uM3(m[3], n)
n <- 10 smp <- rgamma(n, shape = 3) m <- mean(smp) for (j in 2:3) { m <- c(m, mean((smp - m[1])^j)) } uM3(m[3], n)
Calculate pooled unbiased estimates of central moments and their powers and products.
uM3pool(m3, n_x, n_y)
uM3pool(m3, n_x, n_y)
m3 |
naive biased third central moment estimate |
n_x |
number of observations in the first group. |
n_y |
number of observations in the second group. |
Pooled estimate of a third central moment.
Other pooled estimates (two-sample):
uM2M3pool()
,
uM2M4pool()
,
uM2pool()
,
uM2pow2pool()
,
uM2pow3pool()
,
uM3pow2pool()
,
uM4pool()
,
uM5pool()
,
uM6pool()
nx <- 10 ny <- 8 shp <- 3 smpx <- rgamma(nx, shape = shp) - shp smpy <- rgamma(ny, shape = shp) mx <- mean(smpx) my <- mean(smpy) m <- numeric(3) for (j in 2:3) { m[j] <- mean(c((smpx - mx)^j, (smpy - my)^j)) } uM3pool(m[3], nx, ny)
nx <- 10 ny <- 8 shp <- 3 smpx <- rgamma(nx, shape = shp) - shp smpy <- rgamma(ny, shape = shp) mx <- mean(smpx) my <- mean(smpy) m <- numeric(3) for (j in 2:3) { m[j] <- mean(c((smpx - mx)^j, (smpy - my)^j)) } uM3pool(m[3], nx, ny)
Calculate unbiased estimates of central moments and their powers and products.
uM3pow2(m2, m3, m4, m6, n)
uM3pow2(m2, m3, m4, m6, n)
m2 |
naive biased variance estimate |
m3 |
naive biased third central moment estimate |
m4 |
naive biased fourth central moment estimate |
m6 |
naive biased sixth central moment estimate |
n |
sample size. |
Unbiased estimate of squared third central moment
, where
is a third central
moment.
Other unbiased estimates (one-sample):
uM2()
,
uM2M3()
,
uM2M4()
,
uM2pow2()
,
uM2pow3()
,
uM3()
,
uM4()
,
uM5()
,
uM6()
n <- 10 smp <- rgamma(n, shape = 3) m <- mean(smp) for (j in 2:6) { m <- c(m, mean((smp - m[1])^j)) } uM3pow2(m[2], m[3], m[4], m[6], n)
n <- 10 smp <- rgamma(n, shape = 3) m <- mean(smp) for (j in 2:6) { m <- c(m, mean((smp - m[1])^j)) } uM3pow2(m[2], m[3], m[4], m[6], n)
Calculate pooled unbiased estimates of central moments and their powers and products.
uM3pow2pool(m2, m3, m4, m6, n_x, n_y)
uM3pow2pool(m2, m3, m4, m6, n_x, n_y)
m2 |
naive biased variance estimate |
m3 |
naive biased third central moment estimate |
m4 |
naive biased fourth central moment estimate |
m6 |
naive biased sixth central moment estimate |
n_x |
number of observations in the first group. |
n_y |
number of observations in the second group. |
Pooled estimate of squared third central moment
, where
is a third central
moment.
Other pooled estimates (two-sample):
uM2M3pool()
,
uM2M4pool()
,
uM2pool()
,
uM2pow2pool()
,
uM2pow3pool()
,
uM3pool()
,
uM4pool()
,
uM5pool()
,
uM6pool()
nx <- 10 ny <- 8 shp <- 3 smpx <- rgamma(nx, shape = shp) - shp smpy <- rgamma(ny, shape = shp) mx <- mean(smpx) my <- mean(smpy) m <- numeric(6) for (j in 2:6) { m[j] <- mean(c((smpx - mx)^j, (smpy - my)^j)) } uM3pow2pool(m[2], m[3], m[4], m[6], nx, ny)
nx <- 10 ny <- 8 shp <- 3 smpx <- rgamma(nx, shape = shp) - shp smpy <- rgamma(ny, shape = shp) mx <- mean(smpx) my <- mean(smpy) m <- numeric(6) for (j in 2:6) { m[j] <- mean(c((smpx - mx)^j, (smpy - my)^j)) } uM3pow2pool(m[2], m[3], m[4], m[6], nx, ny)
Calculate unbiased estimates of central moments and their powers and products.
uM4(m2, m4, n)
uM4(m2, m4, n)
m2 |
naive biased variance estimate |
m4 |
naive biased fourth central moment estimate |
n |
sample size. |
Unbiased estimate of a fourth central moment.
Other unbiased estimates (one-sample):
uM2()
,
uM2M3()
,
uM2M4()
,
uM2pow2()
,
uM2pow3()
,
uM3()
,
uM3pow2()
,
uM5()
,
uM6()
n <- 10 smp <- rgamma(n, shape = 3) m <- mean(smp) for (j in 2:4) { m <- c(m, mean((smp - m[1])^j)) } uM4(m[2], m[4], n)
n <- 10 smp <- rgamma(n, shape = 3) m <- mean(smp) for (j in 2:4) { m <- c(m, mean((smp - m[1])^j)) } uM4(m[2], m[4], n)
Calculate pooled unbiased estimates of central moments and their powers and products.
uM4pool(m2, m4, n_x, n_y)
uM4pool(m2, m4, n_x, n_y)
m2 |
naive biased variance estimate |
m4 |
naive biased fourth central moment estimate |
n_x |
number of observations in the first group. |
n_y |
number of observations in the second group. |
Pooled estimate of a fourth central moment.
Other pooled estimates (two-sample):
uM2M3pool()
,
uM2M4pool()
,
uM2pool()
,
uM2pow2pool()
,
uM2pow3pool()
,
uM3pool()
,
uM3pow2pool()
,
uM5pool()
,
uM6pool()
nx <- 10 ny <- 8 shp <- 3 smpx <- rgamma(nx, shape = shp) - shp smpy <- rgamma(ny, shape = shp) mx <- mean(smpx) my <- mean(smpy) m <- numeric(4) for (j in 2:4) { m[j] <- mean(c((smpx - mx)^j, (smpy - my)^j)) } uM4pool(m[2], m[4], nx, ny)
nx <- 10 ny <- 8 shp <- 3 smpx <- rgamma(nx, shape = shp) - shp smpy <- rgamma(ny, shape = shp) mx <- mean(smpx) my <- mean(smpy) m <- numeric(4) for (j in 2:4) { m[j] <- mean(c((smpx - mx)^j, (smpy - my)^j)) } uM4pool(m[2], m[4], nx, ny)
Calculate unbiased estimates of central moments and their powers and products.
uM5(m2, m3, m5, n)
uM5(m2, m3, m5, n)
m2 |
naive biased variance estimate |
m3 |
naive biased third central moment estimate |
m5 |
naive biased fifth central moment estimate |
n |
sample size. |
Unbiased estimate of a fifth central moment.
Other unbiased estimates (one-sample):
uM2()
,
uM2M3()
,
uM2M4()
,
uM2pow2()
,
uM2pow3()
,
uM3()
,
uM3pow2()
,
uM4()
,
uM6()
n <- 10 smp <- rgamma(n, shape = 3) m <- mean(smp) for (j in 2:5) { m <- c(m, mean((smp - m[1])^j)) } uM5(m[2], m[3], m[5], n)
n <- 10 smp <- rgamma(n, shape = 3) m <- mean(smp) for (j in 2:5) { m <- c(m, mean((smp - m[1])^j)) } uM5(m[2], m[3], m[5], n)
Calculate pooled unbiased estimates of central moments and their powers and products.
uM5pool(m2, m3, m5, n_x, n_y)
uM5pool(m2, m3, m5, n_x, n_y)
m2 |
naive biased variance estimate |
m3 |
naive biased third central moment estimate |
m5 |
naive biased fifth central moment estimate |
n_x |
number of observations in the first group. |
n_y |
number of observations in the second group. |
Pooled estimate of a fifth central moment.
Other pooled estimates (two-sample):
uM2M3pool()
,
uM2M4pool()
,
uM2pool()
,
uM2pow2pool()
,
uM2pow3pool()
,
uM3pool()
,
uM3pow2pool()
,
uM4pool()
,
uM6pool()
nx <- 10 ny <- 8 shp <- 3 smpx <- rgamma(nx, shape = shp) - shp smpy <- rgamma(ny, shape = shp) mx <- mean(smpx) my <- mean(smpy) m <- numeric(5) for (j in 2:5) { m[j] <- mean(c((smpx - mx)^j, (smpy - my)^j)) } uM5pool(m[2], m[3], m[5], nx, ny)
nx <- 10 ny <- 8 shp <- 3 smpx <- rgamma(nx, shape = shp) - shp smpy <- rgamma(ny, shape = shp) mx <- mean(smpx) my <- mean(smpy) m <- numeric(5) for (j in 2:5) { m[j] <- mean(c((smpx - mx)^j, (smpy - my)^j)) } uM5pool(m[2], m[3], m[5], nx, ny)
Calculate unbiased estimates of central moments and their powers and products.
uM6(m2, m3, m4, m6, n)
uM6(m2, m3, m4, m6, n)
m2 |
naive biased variance estimate |
m3 |
naive biased third central moment estimate |
m4 |
naive biased fourth central moment estimate |
m6 |
naive biased sixth central moment estimate |
n |
sample size. |
Unbiased estimate of a sixth central moment.
Other unbiased estimates (one-sample):
uM2()
,
uM2M3()
,
uM2M4()
,
uM2pow2()
,
uM2pow3()
,
uM3()
,
uM3pow2()
,
uM4()
,
uM5()
n <- 10 smp <- rgamma(n, shape = 3) m <- mean(smp) for (j in 2:6) { m <- c(m, mean((smp - m[1])^j)) } uM6(m[2], m[3], m[4], m[6], n)
n <- 10 smp <- rgamma(n, shape = 3) m <- mean(smp) for (j in 2:6) { m <- c(m, mean((smp - m[1])^j)) } uM6(m[2], m[3], m[4], m[6], n)
Calculate pooled unbiased estimates of central moments and their powers and products.
uM6pool(m2, m3, m4, m6, n_x, n_y)
uM6pool(m2, m3, m4, m6, n_x, n_y)
m2 |
naive biased variance estimate |
m3 |
naive biased third central moment estimate |
m4 |
naive biased fourth central moment estimate |
m6 |
naive biased sixth central moment estimate |
n_x |
number of observations in the first group. |
n_y |
number of observations in the second group. |
Unbiased estimate of a sixth central moment.
Other pooled estimates (two-sample):
uM2M3pool()
,
uM2M4pool()
,
uM2pool()
,
uM2pow2pool()
,
uM2pow3pool()
,
uM3pool()
,
uM3pow2pool()
,
uM4pool()
,
uM5pool()
nx <- 10 ny <- 8 shp <- 3 smpx <- rgamma(nx, shape = shp) - shp smpy <- rgamma(ny, shape = shp) mx <- mean(smpx) my <- mean(smpy) m <- numeric(6) for (j in 2:6) { m[j] <- mean(c((smpx - mx)^j, (smpy - my)^j)) } uM6pool(m[2], m[3], m[4], m[6], nx, ny)
nx <- 10 ny <- 8 shp <- 3 smpx <- rgamma(nx, shape = shp) - shp smpy <- rgamma(ny, shape = shp) mx <- mean(smpx) my <- mean(smpy) m <- numeric(6) for (j in 2:6) { m[j] <- mean(c((smpx - mx)^j, (smpy - my)^j)) } uM6pool(m[2], m[3], m[4], m[6], nx, ny)
Calculate unbiased pooled estimates of central moments and their powers and products up to specified order.
uMpool(smp, a, order)
uMpool(smp, a, order)
smp |
sample. |
a |
vector of the same length as |
order |
highest order of the estimates to calclulate. Estimates of lower orders will be included. |
Pooled estimates up to the 6th order can be calculated. Second and third
orders contain estimates of the variance and third central moment, fourth
order includes estimates of fourth moment and squared variance
(), fifth order - of fifth moment and a product of
second and third moments (
), sixth order - of
sixth moment, a product of second and fourth moments (
), squared third moment (
), and
cubed variance (
).
A named vector of estimates of central moments and their powers and
products up to order
. The highest order available is 6th. The names
of the elements are "M2", "M3", "M4", "M5", "M6"
for corresponding
central moments, "M2M3", "M2M4"
for products of the moments (second
and third, second and fourth), and "M2pow2", "M2pow3", "M3pow2"
for
powers of the moments - corresponding to estimates of squared variance,
cubed variance, and squared third moment.
Gerlovina, I. and Hubbard, A.E. (2019). Computer algebra and algorithms for unbiased moment estimation of arbitrary order. Cogent Mathematics & Statistics, 6(1).
uM
for one-sample unbiased estimates.
nsmp <- 23 smp <- rgamma(nsmp, shape = 3) treatment <- sample(0:1, size = nsmp, replace = TRUE) uMpool(smp, treatment, 6)
nsmp <- 23 smp <- rgamma(nsmp, shape = 3) treatment <- sample(0:1, size = nsmp, replace = TRUE) uMpool(smp, treatment, 6)