ranova: Robust ANOVA

View source: R/ranova.h.R

ranovaR Documentation

Robust ANOVA

Description

Robust Analysis of Variance

Usage

ranova(
  data,
  dep,
  factors = NULL,
  method = "trim",
  ph = FALSE,
  tr = 0.2,
  est = "mom",
  nboot = 599,
  dist = "proj"
)

Arguments

data

the data as a data frame

dep

a string naming the dependent variable from data; the variable must be numeric

factors

a vector of strings naming the fixed factors from data

method

'median', 'trim' (default) or 'boot'; the method to use, median, trimmed means, or bootstrapped

ph

TRUE or FALSE (default), provide post hoc tests

tr

a number between 0 and 0.5, (default: 0.2), the proportion of measurements to trim from each end, when using the trim and bootstrap methods

est

'onestep', 'mom' (default) or 'median', the M-estimator to use; One-step, Modified one-step or Median respectively

nboot

a number (default: 599) specifying the number of bootstrap samples to use when using the bootstrap method

dist

'maha' or 'proj' (default), whether to use Mahalanobis or Projection distances respectively

Value

A results object containing:

results$main the table of ANOVA results
results$phs the table of posthoc tests

Tables can be converted to data frames with asDF or as.data.frame. For example:

results$main$asDF

as.data.frame(results$main)

Examples

data('goggles', package='WRS2')

ranova(goggles,
       dep = 'attractiveness',
       factors = c('gender', 'alcohol'),
       ph = TRUE)

#
#  ROBUST ANOVA
#
#  Robust ANOVA
#  ------------------------------------
#                      Q        p
#  ------------------------------------
#    gender             1.67    0.209
#    alcohol           48.28    0.001
#    gender:alcohol    26.26    0.001
#  ------------------------------------
#   Note. Method of trimmed means,
#   trim level 0.2
#
#
#  POST HOC TESTS
#
#  Post Hoc Tests - gender
#  --------------------------------------------------------
#                       psi-hat   p        Lower    Upper
#  --------------------------------------------------------
#    Female    Male     10.0      0.209    -6.00    26.0
#  --------------------------------------------------------
#
#
#  Post Hoc Tests - alcohol
#  -------------------------------------------------------------
#                           psi-hat   p         Lower    Upper
#  -------------------------------------------------------------
#    None       2 Pints     -3.33      0.611    -20.5     13.8
#    None       4 Pints     35.83     < .001     19.3     52.3
#    2 Pints    4 Pints     39.17     < .001     22.5     55.9
#  -------------------------------------------------------------
#


walrus documentation built on Sept. 8, 2022, 9:07 a.m.