Regcon
Purpose
Converts a regression model to y = ax + b form.
Synopsis
- [a,b] = regcon(mod) % using REGRESSION model
- [a,b] = regcon(regv,xmn,ymn) % mean centered only
- [a,b] = regcon(regv,xmn,ymn,xst,yst) % mean centered and scaled
Description
regcon can be used to convert a model mod generated by the pcr, pls, or analysis functions, into a form expressed by the linear equation y = ax + b.
NOTES:
- (1) regcon can only convert a regression model which uses Mean Centering, Autoscaling, or None as the preprocessing. Any other preprocessing will be rejected and cause an error.
- (2) If the model was built with some variables excluded, regcon will infill with zeros as appropriate so that the output can be used on the original X-block with all variables present.
Alternatively, regcon can be used to convert the individual parts of a regression model, including the vector of regression coefficients regv and the means and scaling factors of the x- and y-block variables, to y = ax + b form.
Inputs
Alternatively, the following 5 individual parts of a regression model can be used as inputs:
- regv = column vector of regression coefficients
- xmn = predictor variable means
- ymn = predicted variable means
- xst = predictor variable scaling
- yst = predicted variable scaling
Note: If xmn or ymn is not supplied or is set equal to 0 or [], then it is assumed to be zero (i.e. no centering was used in the model). If xst or yst is not supplied or is set equal to 0 or [], then it is assumed to be one (i.e. no scaling was used in the model).
Outputs
- a = regression coefficients (a, in y = ax + b)
- b = intercept (b, in y = ax + b)
Examples
- [a,b] = regcon(mod); using REGRESSION model
- [a,b] = regcon(regv,xmn,ymn); mean centered only
- [a,b] = regcon(regv,xmn,ymn,xst,yst); mean centered and scaled
- [a,b] = regcon(regv,xmn,ymn,[],yst); x data centered but not scaled
- [a,b] = regcon(regv,0,0,xst,yst); x and y scaled by not centered