wtd.anova {weights}R Documentation

Weighted one-way ANOVA

Description

wtd.anova performs a weighted analysis of variance across groups using a continuous response variable and a grouping factor.

Usage

wtd.anova(response, group, weight = NULL)

Arguments

response

Numeric vector of outcome values.

group

Factor indicating group membership.

weight

Optional numeric vector of weights. If NULL, equal weights are used.

Value

A data frame with rows for "Between" and "Within" group variance and columns for SS, df, MS, F statistic, and p-value.

Author(s)

Josh Pasek

See Also

aov, lm

Examples

set.seed(1)
group <- rep(c("A", "B", "C"), each = 10)
x <- c(rnorm(10), rnorm(10, mean = 1), rnorm(10, mean = 2))
w <- runif(30, 0.5, 2)
wtd.anova(x, group, weight = w)

[Package weights version 1.1.2 Index]