sim_quasianscombe_set_5: Generate _quasi_ Anscombe data sets Type 5:...

View source: R/quasianscombe.R

sim_quasianscombe_set_5R Documentation

Generate quasi Anscombe data sets Type 5: Heteroskedasticity

Description

Data sets Type 5 recreates the phenomenon of heteroskedasticity in the residuals.

Usage

sim_quasianscombe_set_5(df, fun = identity, residual_factor = 10)

Arguments

df

A data frame from sim_quasianscombe_set_1 (or similar).

fun

A function to apply to the index to multiply the residuals of the original model.

residual_factor

Numeric value to multiply residual to modify their variance.

Details

This function will take residuals $e_i$ and then get $e'_i = e_i * fun(i)$ and then rescale the $e'_i$ to the range of $e_i$.

Examples


df <- sim_quasianscombe_set_1()

dataset5 <- sim_quasianscombe_set_5(df)

dataset5

plot(dataset5)

plot(sim_quasianscombe_set_5(df, fun = rev))

plot(sim_quasianscombe_set_5(df, fun = sqrt))

plot(sim_quasianscombe_set_5(df, fun = log))

plot(sim_quasianscombe_set_5(df, fun = function(x) x^(1+0.6)))


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