lm.ols.refit: Get the ordinary least square estimated coefficients on a set...

Description Usage Arguments Examples

View source: R/fit_helper.r

Description

Get the ordinary least square estimated coefficients on a set of covariates (previously selected by some method

Usage

1
lm.ols.refit(X, Y, intercept, est.betas)

Arguments

X

covariates (n times p matrix, n: number of entries, p: number of covariates)

Y

response (vector with n entries)

intercept

TRUE to fit the data with an intercept, FALSE to fit the data without an intercept

est.betas

estimated betas from previous fitted result. It can be a vector with p+1 entries (first entry as intercept) or a matrix with p+1 columns. Non-zero coefficient means the corresponding covariate is selected

Examples

1
2
3
4
5
6
X = matrix(rnorm(1000), nrow = 100)
Y = rowSums(X[,1:3])+rnorm(100)
est.beta = rep(0, 11)
est.beta[2:5] = 1
ols.mod = lm.ols.refit(X, Y, intercept = FALSE, est.betas = est.beta)
print(ols.mod$est.b)

christineyuen/VSC documentation built on Oct. 8, 2019, 10:45 a.m.