FAQ - Frequently Asked Questions

 Browse FAQ      Browse Documentation Wiki   movie Browse EigenGuide Videos
SearchSearch for Keyword(s):


    Where do I find the regression vector (B) and regression intercept (B0) for a PLS or PCR model?

Possible Solutions:

    NOTE: If you are trying to implement a model in an on-line prediction environment, please see our Model_Exporter and Solo_Predictor products or contact us regarding use of on-line 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 add-on 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.reg 
    B0 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:
    for the x-block and
    for the y-block. If you are using ONLY mean centering or autoscaling (i.e. no other preprocessing steps), the y-block mean is stored in:
    This may look like a terribly complicated command, but basically, it is saying that from preprocessing for the y-block "{2}" pull the first step "(1)" and return the first stored value ".out{1}". This will be the mean from your y-block (or means for multi-column y). If you are using autoscaling, there will also be a vector of standard deviations:
    Here are several simple situations and the equations you can use this information in:

    * If you have mean-centered 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*b
    This returns y_hat in preprocessed y-block units.

    * If your model used ONLY mean-centering on ONLY the y-block (the model contained NO preprocessing on the X-block), 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 y-block units.

    * If your model used ONLY autoscaling on ONLY the y-block (the model contained NO preprocessing of the X-block), 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 y-block 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