| regsimulate | R Documentation | 
Simulates a dataset with n observation from the linear regression model
y = β_0 + β_1 * x_1 + ... + β_k * x_k + ε, ε ~ N(0, σ_ ε^2)
with covariates (x) simulated from a normal distribution with the same correlation rho_x 
between all pairs of covariates. Covariate x_j has standard deviation sigma_x[j]. 
Alternatively the covariate can follow a uniform distribution.
regsimulate( n, betavect, sigma_eps, intercept = TRUE, covdist = "normal", rho_x = 0, sigma_x = rep(1, length(betavect) - intercept) )
| n | the number of observations in the simulated dataset. | 
| betavect | a vector with regression coefficients
c(beta_0,beta_1,...beta_k). First element is intercept if  | 
| sigma_eps | standard deviation of the error terms, epsilon. | 
| intercept | if  | 
| covdist | distribution of the covariates. Options:  | 
| rho_x | correlation among the covariates. Same for all covariate pairs. | 
| sigma_x | vector with standard deviation of the covariates. | 
dataframe with simulated data (y, X1, X2, ..., XK) (no intercept included).
library(regkurs) simdata <- regsimulate(n = 500, betavect = c(1, -2, 1, 0), sigma_eps = 2) lmfit <- lm(y ~ X1 + X2 + X3, data = simdata) regsummary(lmfit, anova = F)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.