ps_pcaGaussian: ps_pcaGaussian

View source: R/ps_pcaGaussian.R

ps_pcaGaussianR Documentation

ps_pcaGaussian

Description

Check whether first two principal components are Gaussian

Usage

ps_pcaGaussian(
  doc = "ps_pcaGaussian",
  data,
  GroupVar,
  Groups,
  gaussID = " ",
  analyticVars,
  varPair = c("PC1", "PC2"),
  qqPlot = TRUE,
  gaussIdentify = FALSE,
  folder = " "
)

Arguments

doc

Documentation for the analysis, default if the function name

data

An R matrix or data frame containing the data to be analyzed

GroupVar

The name for variable defining grouping; a group variable is required

Groups

A vector of values of group variable for which plots are to be done; if "All"', use all groups

gaussID

An optional name for an ID, default is " " if no ID

analyticVars

A vector of names (character values) of analytic results

varPair

A vector of names (character values) of the variable pair to be analyzed, default is first two principal components

qqPlot

Logical, should Q-Q plots (univariate with the bootstrap envelope, multivariate) be shown; default is TRUE

gaussIdentify

Logical, should user identify points of interest, default is FALSE

folder

The path to the folder in which data frames will be saved; default is " "

Value

The function returns a list with the following components:

  • usage: A vector with the contents of the argument doc, the date run, the version of R used

  • dataUsed: The contents of the argument data restricted to the groups used

  • dataNA: A data frame with observations containing a least one missing value for an analysis variable, NA if no missing values

  • params_grouping: A list with the values of the arguments GroupVar and Groups

  • analyticVars: A vector with the value of the argument analyticVars

  • params_logical: The value of QQtest

  • p_values: A data frame with the p-values for the Gaussian assumptions for each group specified

  • dataCheck: A data frame with data identified as generating points of interest; value is NA if no points are identified

  • location: The value of the parameter folder

Details

This function uses the function ps_2dPlotGauss(). The function produces p-values from univariate and multivariate tests of normality. It produces Q-Q plots of the first two principal components for each group, as well as those plots with bootstrap envelopes and the bivariate Q-Q plot if qqPlot=TRUE.

Examples

data(ObsidianSources)
analVars<-c("Rb","Sr","Y","Zr","Nb")
pca_Gauss <- ps_pcaGaussian(data=ObsidianSources, GroupVar="Code",Groups=c("A","B"),
  analyticVars=analVars)


benmarwick/karon documentation built on July 29, 2023, 10:11 a.m.