meanvar: Mean and Variance of Data Subsets

Description Usage Arguments Examples

View source: R/diag.R

Description

Splits the data into subsets according to the X levels, compute mean and variance of the response for each.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
meanvar(formula, data, ..., na.action = na.omit)

## S3 method for class 'meanvar'
as.data.frame(obj, ...)

## S3 method for class 'meanvar'
print(obj, ...)

## S3 method for class 'meanvar'
plot(obj, formula, ...)

Arguments

formula

a formula, such as y ~ x, where the y variable are numeric data to be split into groups according to the grouping x variables.

data

a data frame

obj

an meanvar object

formula

mean-vairance relationship, for example, sd ~ mean, sd ~ mean + I(mean^2), var ~ mean, etc.

Examples

1
2
meanvar(Y ~ X, restaurant)
plot(meanvar(Y ~ X, restaurant), sd ~ mean + I(mean^2))

regbook/regbook documentation built on June 27, 2020, 10:15 p.m.