Description Usage Arguments Value Note Author(s) See Also Examples
View source: R/utility_functions.R
Function used to create initial estimates in fitting algorithm
of the strong heredity interaction model implemented in the
shim function
1 2  | 
x | 
 Design matrix of dimension   | 
y | 
 response variable (matrix form) of dimension   | 
type | 
 The procedure used to estimate the regression coefficients. If
  | 
variables | 
 character vector of variable names for which you want the
univariate regression estimate. Must be contained in the column names of
  | 
include.intercept | 
 Should intercept be fitted (default is
  | 
Regression coefficients as a q x 1 data.frame
p is defined as the number of main effects. I have introduced
q as being the total number of variables (e.g. the number of columns
in the design matrix).
Sahir Bhatnagar
Maintainer: Sahir Bhatnagar sahir.bhatnagar@mail.mcgill.ca
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  | # number of observations
n <- 100
# number of predictors
p <- 5
# environment variable
e <- sample(c(0,1), n, replace = T)
# main effects
x <- cbind(matrix(rnorm(n*p), ncol = p), e)
# need to label columns
dimnames(x)[[2]] <- c(paste0("x",1:p), "e")
# design matrix without intercept
X <- model.matrix(~(x1+x2+x3+x4+x5)*e-1, data = as.data.frame(x))
# response
Y <- X %*% rbinom(ncol(X), 1, 0.2) + 3*rnorm(n)
uni_fun(X, Y)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.