wtd.chi.sq: Produces weighted chi-squared tests.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/wtd.chi.sq.r

Description

wtd.chi.sq produces weighted chi-squared tests for two- and three-variable contingency tables. Decomposes parts of three-variable contingency tables as well. Note that weights run with the default parameters here treat the weights as an estimate of the precision of the information. A prior version of this software was set to default to mean1=FALSE.

Usage

1
2
wtd.chi.sq(var1, var2, var3=NULL, weight=NULL, na.rm=TRUE,
drop.missing.levels=TRUE, mean1=TRUE)

Arguments

var1

var1 is a vector of values which the researcher would like to use to divide any data set.

var2

var2 is a vector of values which the researcher would like to use to divide any data set.

var3

var3 is an optional additional vector of values which the researcher would like to use to divide any data set.

weight

weight is an optional vector of weights to be used to determine the weighted chi-squared for all analyses.

na.rm

na.rm removes missing data from analyses.

drop.missing.levels

drop.missing.levels drops missing levels from variables.

mean1

mean1 is an optional parameter for determining whether the weights should be forced to have an average value of 1. If this is set as false, the weighted correlations will be produced with the assumption that the true N of the data is equivalent to the sum of the weights.

Value

A two-way chi-squared produces a vector including a single chi-squared value, degrees of freedom measure, and p-value for each analysis.

A three-way chi-squared produces a matrix with a single chi-squared value, degrees of freedom measure, and p-value for each of seven analyses. These include: (1) the values using a three-way contingency table, (2) the values for a two-way contingency table with each pair of variables, and (3) assessments for whether the relations between each pair of variables are significantly different across levels of the third variable.

Author(s)

Josh Pasek, Assistant Professor of Communication Studies at the University of Michigan (www.joshpasek.com).

See Also

wtd.cor wtd.t.test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
var1 <- c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3)
var2 <- c(1,1,2,2,3,3,1,1,2,2,3,3,1,1,2)
var3 <- c(1,2,3,1,2,3,1,2,3,1,2,3,1,2,3)
weight <- c(.5,.5,.5,.5,.5,1,1,1,1,1,2,2,2,2,2)

wtd.chi.sq(var1, var2)
wtd.chi.sq(var1, var2, weight=weight)

wtd.chi.sq(var1, var2, var3)
wtd.chi.sq(var1, var2, var3, weight=weight)

weights documentation built on June 11, 2021, 1:06 a.m.

Related to wtd.chi.sq in weights...