sim_quasianscombe_set_6: Generate _quasi_ Anscombe data sets Type 6: Simpson's Paradox

View source: R/quasianscombe.R

sim_quasianscombe_set_6R Documentation

Generate quasi Anscombe data sets Type 6: Simpson's Paradox

Description

Data sets Type 6 recreates the phenomenon of Simpon's paradox.

Usage

sim_quasianscombe_set_6(df, groups = 3, b1_factor = -1, residual_factor = 0.25)

Arguments

df

A data frame from sim_quasianscombe_set_1 (or similar).

groups

Number of groups to separate x values.

b1_factor

A numeric value get the slope in each group from $beta_1$.

residual_factor

Numeric value to multiply residual to modify their variance.

Details

This function will take x vector and separate groups groups to apply a local model with a modified regression using the b1_factor factor.

The residual will be multiply with a value between 0 and 1 to make the visual effect greater.

Examples


df <- sim_quasianscombe_set_1()

dataset6 <- sim_quasianscombe_set_6(df)

dataset6

plot(dataset6)


jbkunst/klassets documentation built on Dec. 7, 2022, 9:18 p.m.