Description Usage Arguments Value Examples
Wrapper for parallel simfun. Takes a linear regression model fit by lm and returns the results information on the distribution of possible effects. Currently implimented in both R and C++. The C++ version is faster while the R version is easier for the expected user base to read and modify as needed.
1 |
mod |
A linear regression model fit by lm. |
nsims |
numeric. How many draws to take? |
language |
character, either "cpp" or "R" determining which implimentation to use. |
n.cores |
numeric. How many cores should the simulation be run on? |
buff |
numeric. A buffer to avoid numeric positive non-definiteness. |
Returns a data.frame of nsims + 1 rows, with the last row containing the input coefficients. Includes intercept, regressor coefficients, control function coefficient, and R-squared as columns.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | set.seed(8675309)
x_vars <- 5
n_obs <- 1000
corm <- RandomCormCPP(nvars = x_vars)
X_mat <- MASS::mvrnorm(n_obs, rep(0,x_vars), Sigma = corm, empirical = TRUE)
betas <- 1:x_vars
y <- X_mat
dat <- data.frame(y,X_mat)
mod <- lm(y ~ ., data=dat)
dope <- DOPE(mod, nsims = 3000, n.cores = parallel::detectCores())
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.