FAQ  Frequently Asked Questions
Issue:

Where do I find the regression vector (B) and regression intercept (B_{0}) for a PLS or PCR model?
Possible Solutions:
NOTE: If you are trying to implement a model in an online prediction environment, please see our Model_Exporter and Solo_Predictor products or contact us regarding use of online prediction engines.
Regression models store the regression vector information in units of the preprocessed data. In order to use this, you will either need to use additional information stored in the model to preprocess new data first (before using the regression vector) or use one of a couple of functions to convert the regression vector into one that can be applied to raw data.
For some simple preprocessing situations, you may be able to convert a regression model over to a simple slope (a) and intercept (b) form: y = ax+b using the Analysis menu item: "File > Export Model > To Regression Vector" which uses the PLS_Toolbox regcon function:
>> regcon REGCON Converts regression model to y = ax + b form. 'regcon help' gives extended help I/O: [a,b] = regcon(mod);However, this function will only operate on models with simple autoscaling or mean centering.
More advanced preprocessing methods require either the Model_Exporter addon product, or custom programming to convert into a simple equation format.
Manually Extracting and Applying
To manually extract the regression vector (B) and the intercept (B0), these items would need to be extracted from the model object containing the regression model. The following describes these fields and the preprocessing steps needed to be performed.
The regression vector is stored in the model.reg field of the model:
b = model.regB_{0} is more subtle. In PLS_Toolbox, the regression vector and intercept are stored in terms of preprocessed data and the intercept is effectively zero.
Preprocessing information in general can be found in:
model.detail.preprocessing{1}for the xblock and
model.detail.preprocessing{2}for the yblock. If you are using ONLY mean centering or autoscaling (i.e. no other preprocessing steps), the yblock mean is stored in:
model.detail.preprocessing{2}(1).out{1}This may look like a terribly complicated command, but basically, it is saying that from preprocessing for the yblock "{2}" pull the first step "(1)" and return the first stored value ".out{1}". This will be the mean from your yblock (or means for multicolumn y). If you are using autoscaling, there will also be a vector of standard deviations:
model.detail.preprocessing{2}(1).out{2}Here are several simple situations and the equations you can use this information in:
* If you have meancentered both X and Y prior to building the model (or applying it to new data), you can calculate a y prediction (y_hat) using:
b = model.reg; y_hat = x*bThis returns y_hat in preprocessed yblock units.
* If your model used ONLY meancentering on ONLY the yblock (the model contained NO preprocessing on the Xblock), the following will make a prediction:
b = model.reg; y_mn = model.detail.preprocessing{2}.out{1}; y_hat = x*b + y_mn;This returns y_hat in original yblock units.
* If your model used ONLY autoscaling on ONLY the yblock (the model contained NO preprocessing of the Xblock), this will make a prediction:
b = model.reg; y_mn = model.detail.preprocessing{2}.out{1}; y_sc = model.detail.preprocessing{2}.out{2}; y_hat = (x*b)*diag(y_sc) + y_mn;This also returns y_hat in original yblock units.
For other preprocessing methods, you will need to use the "preprocess" function to apply the preprocessing.
Still having problems? Check our documentation Wiki or try writing our helpdesk at helpdesk@eigenvector.com