cmpoutput: Compares output observations from two or more groups

View source: R/cmpoutput.R

cmpoutputR Documentation

Compares output observations from two or more groups

Description

Compares output observations from two or more groups.

Usage

cmpoutput(name, ve_npcs, data, obs_lvls, lim_npcs = TRUE, mnv_test = "Pillai")

Arguments

name

Comparison name (useful when calling this function to perform multiple comparisons).

ve_npcs

Percentage (0 < ve_npcs < 1) of variance explained by the q principal components (i.e. number of dimensions) used in MANOVA, or the number of principal components (ve_npcs > 1, must be integer). Can be a vector, in which case the MANOVA test will be applied multiple times, one per specified variance to explain / number of principal components.

data

A n x m matrix, where n is the total number of output observations (runs) and m is the number of variables (i.e. output length).

obs_lvls

Levels or groups associated with each observation.

lim_npcs

Limit number of principal components used for MANOVA to minimum number of observations per group?

mnv_test

The name of the test statistic to be used in MANOVA, as described in summary.manova.

Value

Object of class cmpoutput containing the following data:

scores

n x n matrix containing projections of output data in the principal components space. Rows correspond to observations, columns to principal components.

obs_lvls

Levels or groups associated with each observation.

varexp

Percentage of variance explained by each principal component.

npcs

Number of principal components specified in ve_npcs OR which explain the variance percentages given in ve_npcs.

ve

Percentage (between 0 and 1) of variance explained by the q principal components (i.e. number of dimensions) used in MANOVA.

name

Comparison name (useful when calling this function to perform multiple comparisons).

p.values

P-values for the performed statistical tests, namely:

manova

List of p-values for the MANOVA test for each number of principal component in npcs.

parametric

Vector of p-values for the parametric test applied to groups along each principal component (t-test for 2 groups, ANOVA for more than 2 groups).

nonparametric

Vector of p-values for the non-parametric test applied to groups along each principal component (Mann-Whitney U test for 2 groups, Kruskal-Wallis test for more than 2 groups).

parametric_adjusted

Same as field parametric, but p-values are adjusted using weighted Bonferroni procedure. Percentages of explained variance are used as weights.

nonparametric_adjusted

Same as field nonparametric, but p-values are adjusted using weighted Bonferroni procedure. Percentages of explained variance are used as weights.

tests
manova

Objects returned by the manova function for each value specified in ve_npcs.

parametric

List of objects returned by applying t.test (two groups) or aov (more than two groups) to each principal component.

nonparametric

List of objects returned by applying wilcox.test (two groups) or kruskal.test (more than two groups) to each principal component.

Examples


# Comparing the first output ("Pop.Sheep") of one the provided datasets.
cmp <-
 cmpoutput("SheepPop", 0.8, pphpc_ok$data[["Pop.Sheep"]], pphpc_ok$obs_lvls)

# Compare bogus outputs created from 2 random sources, 5 observations per
# source, 20 variables each, yielding a 10 x 20 data matrix.
data <- matrix(c(rnorm(100), rnorm(100, mean = 1)), nrow = 10, byrow = TRUE)
olvls <- factor(c(rep("A", 5), rep("B", 5)))
cmp <- cmpoutput("Bogus", 0.7, data, olvls)


FakenMC/micompr documentation built on Jan. 31, 2024, 5:09 a.m.