sim_data: Simulate data with specified R2

Description Usage Arguments Value

Description

Simulate data with specified R2

Usage

1
sim_data(r2 = 0.2, n = 1e+06, p = 5, adjusted.r.square = FALSE)

Arguments

r2

desired adjusted R2 as numeric vector of length one

n

number of samples (rows)

p

number of dependent variables

adjusted.r.square

is the given r2 value adjusted? (it will then be "unadjusted")

Value

Object of class "sim_data" wich is basically a data.frame with first column "Y" and preceding columns "Xi" (i = 1, ..., p) where summary(lm(Y ~ ., data = d))$r.squared is approximately r2 and with some exrta attributes Rsquared and RMSE with coresponding values based on the whole data.frame


eribul/r2samplesize documentation built on May 16, 2019, 8:25 a.m.