| moments | R Documentation |
moments returns the sample moments of a data vector/matrix
moments( x, skew.type = NULL, kurt.type = NULL, kurt.excess = FALSE, na.rm = TRUE, include.sd = FALSE )
x |
A data vector/matrix/list |
skew.type |
The type of kurtosis statistic used ('Moment', 'Fisher Pearson' or 'Adjusted Fisher Pearson') |
kurt.type |
The type of kurtosis statistic used ('Moment', 'Fisher Pearson' or 'Adjusted Fisher Pearson') |
kurt.excess |
Logical value; if |
na.rm |
Logical value; if |
include.sd |
Logical value; if |
This function computes the sample moments for a data vector, matrix or list (sample mean, sample variance, sample skewness and sample kurtosis).
For a vector input the function returns a single value for each sample moment of the data. For a matrix or list input the function treats each
column/element as a data vector and returns a matrix of values for the sample moments of each of these datasets. The function can compute
different types of skewness and kurtosis statistics using the skew.type, kurt.type and kurt.excess inputs. (For details
on the different types of skewness and kurtosis statistics, see Joanes and Gill 1998.)
A data frame containing the sample moments of the data vector/matrix
#Create some subgroups of mock data and a pooled dataset set.seed(1) N <- c(28, 44, 51) SUB1 <- rnorm(N[1]) SUB2 <- rnorm(N[2]) SUB3 <- rnorm(N[3]) DATA <- list(Subgroup1 = SUB1, Subgroup2 = SUB2, Subgroup3 = SUB3) POOL <- c(SUB1, SUB2, SUB3) #Compute sample moments for subgroups and pooled data MOMENTS <- moments(DATA) POOLMOM <- moments(POOL) #Compute pooled moments via sample decomposition sample.decomp(moments = MOMENTS)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.