Learn R Programming

psycho (version 0.4.91)

simulate_data_regression: Simulates data for single or multiple regression.

Description

Simulates data for single or multiple regression.

Usage

simulate_data_regression(coefs = 0.5, sample = 100, error = 0)

Arguments

coefs

Desired theorethical coefs. Can be a single value or a list.

sample

Desired sample size.

error

The error (standard deviation of gaussian noise).

Details

See https://stats.stackexchange.com/questions/59062/multiple-linear-regression-simulation

Examples

Run this code
# NOT RUN {
library(psycho)

data <- simulate_data_regression(coefs = c(0.1, 0.8), sample = 50, error = 0)
fit <- lm(y ~ ., data = data)
coef(fit)
analyze(fit)
# }

Run the code above in your browser using DataLab