propTestN {jmv}R Documentation

Proportion Test (N Outcomes)

Description

X² Goodness of fit

Usage

propTestN(data, var, counts = NULL, expected = FALSE, ratio = NULL)

Arguments

data

the data as a data frame

var

a string naming the variable of interest in data

counts

a string naming a variable in data containing counts, or NULL if each row represents a single observation

expected

TRUE or FALSE (default), whether expected counts should be displayed

ratio

a vector of numbers: the expected proportions

Value

A results object containing:

results$props a table of the proportions
results$tests a table of the test results

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

results$props$asDF

as.data.frame(results$props)

Examples

data('HairEyeColor')
dat <- as.data.frame(HairEyeColor)

propTestN(dat, var = 'Eye', counts = 'Freq', ratio = c(1,1,1,1))

#
#  PROPORTION TEST (N OUTCOMES)
#
#  Proportions
#  --------------------------------
#    Level    Count    Proportion
#  --------------------------------
#    Brown      220         0.372
#    Blue       215         0.363
#    Hazel       93         0.157
#    Green       64         0.108
#  --------------------------------
#
#
#  X² Goodness of Fit
#  -----------------------
#    X²     df    p
#  -----------------------
#    133     3    < .001
#  -----------------------
#


[Package jmv version 0.9.2.0 Index]