bivariate: Functions to compute statistics on bivariate distributions

Description Usage Arguments Value Author(s) Examples

Description

These functions are intended to compute from a cont_table objects covariation statistics, ie the covariance, the correlation coefficient, variance decomposition and regression line.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
covariance(data, ...)

correlation(data, ...)

## S3 method for class 'cont_table'
covariance(data, ...)

## S3 method for class 'cont_table'
correlation(data, ...)

## S3 method for class 'cont_table'
anova(object, x, ...)

## S3 method for class 'anova.cont_table'
summary(object, ...)

regline(formula, data)

Arguments

data, object

a cont_table object,

...

further arguments.

x

the series for which the analyse of variance should be computed,

formula

symbolic description of the model,

Value

a numeric or a tibble

Author(s)

Yves Croissant

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# the covariance and the linear correlation coefficient are
# computed using only the `cont_table`
# First reduce the number of bins
wages2 <- wages %>%
          dplyr::mutate(size = cut(as_bin(size), c(20, 50, 100)),
                        wage = cut(as_bin(wage), c(10, 30, 50)))
wages2 %>% cont_table(wage, size) %>% covariance
wages2 %>% cont_table(wage, size) %>% correlation
# For the analyse of variance, one of the two series should be
# indicated
wages2 %>% cont_table(wage, size) %>% anova(wage)
wages2 %>% cont_table(wage, size) %>% anova(wage) %>% summary
# For the regression line, a formula should be provided
wages2 %>% cont_table(wage, size) %>% regline(formula = wage ~ size)

descstat documentation built on Feb. 17, 2021, 5:07 p.m.