# transformMoment: Transform raw moments into central moments and vice versa In CharlotteJana/momcalc: Symbolic Moment Calculation

## Description

Let X be a random variable and Y the corresponding centered variable, i.e. Y = X - μ. Let p be the `order` of the desired moment.

If type = 'raw', this function returns

E(X^p) = ∑ choose(p,k)*μ^(p-k)*E(Y^k),

where the sum is taken over any row `k` in `expand.grid(lapply(1:n, function(i) 0:p[i]))`.

The values of E(Y^k) are replaced by

• `centralMoment[[i]]`, if `k` = `centralMomentOrders[i, ]`

• `transformMoment(type = 'central', ...)`, if `k` is a row in `rawMomentOrders`

• `symbolicMoments(closure, k)`, if `k` is neither a row in `centralMomentOrders` nor in `rawMomentOrders`

If type = 'central', this function returns

E(Y^p) = ∑ (-1)^(p-k)*choose(p,k)*μ^(p-k)*E(X^k),

where the sum is taken over any row `k` in `expand.grid(lapply(1:n, function(i) 0:p[i]))`.

The values of E(X^k) are replaced by

• `rawMoment[[i]]`, if `k` = `rawMomentOrders[i, ]`

• `transformMoment(type = 'raw', ...)`, if `k` is not a row in `rawMomentOrders`

## Usage

 ```1 2``` ```transformMoment(order, type, momentList, closure = "zero", simplify = TRUE) ```

## Arguments

 `order` numeric vector giving the order of the desired moment. `type` string, either 'central' or 'raw'. `momentList` object of class `momentList`. `closure` string giving the closure method to use if a central moment is unknown. Possible values are the same as for argument `distribution` of `symbolicMoments`. `simplify` bool indiciating if the resulting expressions should be simplified. Function `Simplify` from package Deriv is used for simplification.

## Value

This function returns an object of class 'momentList'.

CharlotteJana/momcalc documentation built on Oct. 17, 2019, 7:21 a.m.