Learn R Programming

weights (version 1.1.1)

wtd.anova: 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)

Value

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

Arguments

response

Numeric vector of outcome values.

group

Factor indicating group membership.

weight

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

Author

Josh Pasek

See Also

Examples

Run this code
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)

Run the code above in your browser using DataLab