Multi-output linear regression
regress.Rd
Fit a multivariate regression model for a matrix of basis functions, X
, and a response matrix Y
.
The goal is to find a projection matrix that can be used for mapping and reconstruction.
Arguments
- X
the set of independent (basis) variables
- Y
the response matrix
- preproc
the pre-processor (currently unused)
- method
the regression method:
lm
,enet
,mridge
, orpls
- intercept
whether to include an intercept term
- lambda
ridge shrinkage parameter (for methods
mridge
andenet
)- alpha
the elastic net mixing parameter if method is
enet
- ncomp
number of PLS components if method is
pls
- ...
extra arguments sent to the underlying fitting function
Examples
# Generate synthetic data
Y <- matrix(rnorm(100 * 10), 10, 100)
X <- matrix(rnorm(10 * 9), 10, 9)
# Fit regression models and reconstruct the response matrix
r_lm <- regress(X, Y, intercept = FALSE, method = "lm")
recon_lm <- reconstruct(r_lm)
r_mridge <- regress(X, Y, intercept = TRUE, method = "mridge", lambda = 0.001)
recon_mridge <- reconstruct(r_mridge)
r_enet <- regress(X, Y, intercept = TRUE, method = "enet", lambda = 0.001, alpha = 0.5)
recon_enet <- reconstruct(r_enet)
r_pls <- regress(X, Y, intercept = TRUE, method = "pls", ncomp = 5)
recon_pls <- reconstruct(r_pls)