lm_eclairs | R Documentation |
Fit linear model after applying decorrelation projection to response and predictors.
lm_eclairs(
formula,
data,
ecl,
subset,
weights,
na.action,
method = "qr",
model = TRUE,
x = FALSE,
y = FALSE,
qr = TRUE,
singular.ok = TRUE,
contrasts = NULL,
offset,
...
)
formula |
an object of class 'formula' (or one that can be coerced to that class): a symbolic description of the model to be fitted. |
data |
a matrix or data.frame containing the variables in the model |
ecl |
estimate of covariance/correlation matrix from eclairs storing |
subset |
same as for lm |
weights |
same as for lm |
na.action |
same as for lm |
method |
same as for lm |
model |
same as for lm |
x |
same as for lm |
y |
same as for lm |
qr |
same as for lm |
singular.ok |
same as for lm |
contrasts |
same as for lm |
offset |
same as for lm |
... |
same as for lm |
This function fit a linear regression to the transformed response, and transformed design matrix. Note that the design matrix, not just the data.frame of variables is transformed so that 1) factors are transformed and 2) the intercept term is transformed.
Object of class lm
returned by function lm
library(Rfast)
n <- 800 # number of samples
p <- 200 # number of features
# create correlation matrix
Sigma <- autocorr.mat(p, .9)
# draw data from correlation matrix Sigma
Y <- rmvnorm(n, rep(0, p), sigma = Sigma * 5.1, seed = 1)
# eclairs decomposition
ecl <- eclairs(Y)
# simulate covariates
data <- data.frame(matrnorm(p, 2, seed = 1))
colnames(data) <- paste0("v", 1:2)
# simulate response
y <- rnorm(p)
# fit linear model on transformed data
lm_eclairs(y ~ v1 + v2, data, ecl)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.