Help Manual

Contents






Sigma Magic Help Version 17

Regression

Overview

Regression analysis can be used to develop a model between an output Y and one or more input Xs. The output Y can either be continuous or binary. The input X's can be both continuous and discrete. Regression models can be used to understand which of the input variables (X) have an impact on the output variable. The regression equation can also be used to make predictions or to determine the input parameters that result in an optimal output. The following figure shows a flowchart for the various models that can currently be fit using this software. regression flowchart This tool can be added to your active workbook by clicking on Stats and then selecting Regression Analysis.

Inputs

Click on Analysis Setup to open the menu options for this tool.

Setup

A sample screenshot of the setup menu is shown below.
Regression Input Dialog Box
1
Data Type: Specify the data type you have for your dependent variable (Y). The available options are:
OptionDescription
BinaryA Binary data has two possible values (0/1).
ContinuousContinuous data can take any arbitrary value (like the temperature of the room example, 34.53 degrees centigrade).
2
Model Type: Specify the type of regression model you want to build. The available options if the number of input variables is one are:
OptionDescription
LinearBuild a linear regression model Y = mX + c.
QuadraticBuild a quadratic regression model Y = aX^2 + bX + c.
CubicBuild a cubic regression model Y = aX^3 + bX^2 + cX + d.
The following options are available if there is more than one independent variable.
OptionDescription
LinearBuild a linear regression model of the type Y = c + m1 * x1 + m2 * x2
Linear + InteractionBuild a regression model of the type Y = c + m1 * x1 + m2 * x2 + m3 * x1 * x2
Linear + QuadraticBuild a regression model of the type Y = c + m1 * x1 + m2 * x2 + m3 * x1 * x2 + m4 * x1^2 + m5 * x2 ^ 2
ManualSpecify the terms you want to include in the model by specifying the model terms.
3
Model Reduction: Specify if you want to use model reduction. When you build your model input-output and input(s), sometimes, not all inputs are statistically significant. Some of the input variables may have no impact on the model output. We can not include those terms in the final model in such cases. The model reduction setting lets you pick whether you want to include all or only significant terms. The following options are available:
OptionDescription
NoneNo model reduction is performed, and by default, all terms are included.
AutoThe software will perform backward elimination and keep terms in the final model only if they are statistically significant. The model reduction alpha value determines whether to keep or eliminate the model terms.
4
Model Reduction Alpha: Specify the model reduction alpha value. This value will be used to reduce your regression model. The software starts with the full model and drops those non-significant terms until a fully significant model remains. The default value for model reduction alpha is 10%.
5
Help Button: Click on this button to open the help file for this topic.
6
Flowchart: Click on this button to open the flowchart for regression. The flowchart shows the logic of which analysis you need to perform depending on your specific situation.
7
Cancel Button: Click on this button to cancel all changes to the settings and exit this dialog box.
8
OK Button: Click on this button to save all changes and compute the outputs for this analysis.

Data

You will see the following dialog box if you click the Data button. Here, you can specify the data required for this analysis. Data
1
Num Factors: Specify the number of input variables. The software will fit a simple regression model if the number of input variables is 1. The software will fit a multiple regression model if the number of input variables exceeds 1.
2
Search Data: The available data displays all the columns of data that are available for analysis. You can use the search bar to filter this list and speed up finding the right data for analysis. Enter a few characters in the search field, and the software will filter and display the filtered data in the Available Data box.
3
Available Data: The available data box contains the list of data available for analysis. If your workbook has no data in tabular format, this box will display "No Data Found." The information displayed in this box includes the row number, whether the data is Numeric (N) or Text (T), and the name of the column variable. Note that the software displays data from all the tables in the current workbook. Even though data within the same table have unique column names, columns across different tables can have similar names. Hence, it is crucial that you not only specify the column name but also the table name.
4
Add or View Data: Click on this button to add more data to your workbook for analysis or to view more details about the data listed in the available data box. When you click on this button, it opens the Data Editor dialog box, where you can import more data into your workbook. You can also switch from the list view to a table view to see the individual data values for each column.
4a
View Selection: Click on this button to view the data specified for this analysis. The data can be viewed in a tabular format or a graphical summary.
5
Select Button: Click on this button to select the data for analysis. Any data you choose for the analysis is moved to the right. To select a column, click on the columns in the Available Databox to highlight them and then click on the Select Button. A second method to choose the data is to double-click on the columns in the list of Available Data. Finally, you can drag and drop the columns you are interested in by holding down the select columns using your left mouse key and dragging and dropping them in one of the boxes on the right.
6
Response Variable: The list box header will be displayed in black if the right number of data columns is specified. If sufficient data has not been specified, then the list box header will be displayed in red color. Note that you can double-click on any of the columns in this box to remove them from the box. In this list box, specify the response or the dependent variable. Note that you can only specify one column.

7
Continuous Factors: The data you specify for this analysis depends on the options in the Setup tab. Specify the columns containing the inputs or independent variables under Factor Variables. Note that you can only specify up to N columns for the factor variables. N is the number of input variables specified in the Setup dialog box. Make sure that all the columns contain numeric values.

8
Categorical Factors: If you have any discrete factors, they need to be specified in the list of categorical factors. Note that these factors can be in text format. You need to have at least one continuous variable. The categorical factors are internally converted to continuous factors using dummy variables. For example, a categorical factor named shift has three levels: 1st Shift, 2nd Shift, and 3rd Shift. The first shift is Shift.1, the second shift is Shift.2, and the third shift is Shift.3. You can use these variables in model terms if you want to build a regression model manually.
9
Required Data: The code for the required data specifies what data can be specified for that box. An example code is N: 2-4. If the code starts with an N, you must select only numeric columns. If the code begins with a T, you can select numeric and text columns. The numbers to the right of the colon specify the min-max values. For example, if the min-max values are 2-4, you must select a minimum of 2 columns of data and a maximum of 4 columns in this box. If the minimum value is 0, then no data is required to be specified for this box.

Model

Specify the regression model to fit between the input(s) and the output variable. This model is auto-selected for you based on your setup options. However, you can make changes to this model if required for linear regression. You will see the following dialog box if you click the Model button. Charts
1
Standardize Continuous Factors: By default, the continuous factors will be used as-is to fit a model between the inputs and outputs. However, in some cases, you may want to modify your input variables before they fit the model. The available options are:
OptionDescription
NoneNo changes will be made to the input variable. The values entered in the table will be used to fit the model. This is the default option.
Subtract meanThe mean value will be subtracted from the input variable before fitting the model.
Divide stdevEach data point will be divided by the standard deviation of this column before fitting the model.
Subtract mean and divide stdevThe mean will be subtracted from each data point and divided by the column standard deviation before fitting the model.
2
Reference Categorical Factors: By default, the levels of the categorical factors are sorted, and the last value in this list is assumed to be the reference or the baseline value. If you want to change the reference level to be used for the categorical factor, pick the level you want to use from the dropdown list. Note that this will modify the equation that will fit your data. To refresh the model terms, make sure to click on the refresh button at the top of the dialog box.
3
Model Equation: The model equation that is fit to your data between the output variable (Y) and the input variables (X1, X2, etc.) is shown in this box. The model terms should be separated by the plus (+) sign.

For example, if your input variables are Weight and Length, then the model terms could be Weight + Length + Weight * Length + Weight^2. This will build a regression model with four terms, and the regression model will consider these terms. Ensure that your matrix is not singular when you specify the manual regression terms. For example, if you specify a term that does not exist in your input data set, all values in that input column for that variable will contain 0 values, and your matrix will be singular; hence, you cannot build that model. Another scenario could be a model like A + A*B + A. Here, the A column is repeated twice, making the model singular, and you cannot obtain a solution.

4
Include Constant: This checkbox specifies if you want to include the constant term in your model equation. For example, if you fit a simple linear model between Y and X, then with the constant, the equation would be Y = mX + Constant, and without the constant term, the equation would be Y = mX. Use the model that makes sense for your particular case. If constants are included, then when X = 0, the model output will have a Constant (intercept) value. If no constant is used, the model intercept value is 0.0, meaning Y is also zero when X is zero. That is, the best-fit line passes through the origin.

Options

You will see the following dialog box if you click the Options button. Charts
1
Confidence Level: Specify the confidence level for this analysis. This value is used to determine the prediction and confidence intervals. The default value for confidence level is 95%.
2
Save Results: You can store some of the calculated results on the worksheet. The following checks can be stored. Select the checkboxes for the variables you are interested in, and the software will store these values in the worksheet. The available variables are:
OptionDescription
FitStore the value of the fit in one column. The fit is obtained using the estimated model equation for the inputs specified in the model. Note that the corresponding row for the fit will not be available if not all the inputs have been specified since there are missing values.
Confidence IntervalsStore the lower and upper confidence intervals on the worksheet. The confidence level value used for the fit can be specified in one of the options above.
ResidualsThe residuals are the difference between the raw data points and the best fit line. Ideally, the residuals must be independent and normally distributed with a mean value of 0.
Standardized ResidualsStandardized residuals are the residuals that have been transformed to have a mean of zero and a standard deviation of one. Standardized residuals are useful for identifying outliers and assessing the overall fit of the regression model. If the residuals are normally distributed and have a mean of zero and a standard deviation of one, it indicates that the regression model's assumptions are met. However, if patterns or outliers exist in the standardized residuals, the model may not capture some important relationships in the data. Analyzing standardized residuals can help identify influential data points, diagnose potential problems with the regression model, and guide model improvement.
LeverageLeverage refers to the influence that a data point has on the estimation of the regression coefficients. In other words, leverage measures how much an individual data point affects the shape and position of the regression line. Observations with high leverage can potentially influence the estimated regression coefficients disproportionately. These points have a greater weight in determining the position and slope of the regression line. High leverage points are not necessarily problematic but can be influential if they have large residuals. Influential points can substantially impact the regression model, and their effects should be carefully examined.
Cook's Distance Cook's distance is a statistical measure used in regression analysis to identify influential data points that may disproportionately affect the estimation of regression coefficients. It combines information about the residuals and the leverage of each data point to assess the impact of individual observations on the overall model. Large values of Cook's distance indicate observations that substantially influence the regression model.
3
Fitted Line Plots: You can display a fitted line plot between the input and output if you have a single input variable, X, and a response variable, Y. The raw data points are displayed as a scatter plot, and the best fit is shown as a line. On top of the fitted line plot, we can also include the confidence and prediction intervals. Specify if you want to superimpose the confidence or prediction interval on the regression plot. These intervals are plotted based on the confidence level specified in your analysis. If we were to take many samples from the population and calculate a confidence interval for each sample, the actual parameter would be expected to fall within the interval in a certain percentage of cases. The typical confidence levels are 95% or 99%. The following options are available:
OptionDescription
Confidence IntervalA confidence interval is used to estimate the range within which we expect the true population parameter (such as a regression coefficient) to lie with a certain level of confidence.
Prediction IntervalA prediction interval, on the other hand, is used to estimate the range within which we expect an individual observation to fall with a certain level of confidence. If we were to observe a new data point, the prediction interval gives a range within which we would expect the actual value of that observation to lie with a certain probability.

Charts

You will see the following dialog box if you click the Charts button. Charts
0
Pick Charts: Select the charts you would like to display for this analysis.
1
Title: The system will automatically pick a title for your chart. However, if you want to override that with your title, you can specify a title for your chart here. Note that this input is optional.
2
Sub Title: The system will automatically pick a subtitle for your chart. However, if you want to override that with your subtitle, specify a subtitle for your chart here. Note that this input is optional.
3
X Label: The system will automatically pick a label for the x-axis. However, if you would like to override that with your label for the x-axis, you can specify a different label here. Note that this input is optional.
4
Y Label: The system will automatically pick a label for the y-axis. However, if you would like to override that with your label for the y-axis, you can specify a different label here. Note that this input is optional.
5
X Axis: The system will automatically pick a scale for the x-axis. However, if you would like to override that with your values for the x-axis, you can specify them here. The format for this input is to specify the minimum, increment, and maximum values separated by a semi-colon. For example, if you specify 10;20, the minimum x-axis scale is set at 10, and the maximum x-axis scale is set at 20. If you specify 10;2;20, then, in addition to minimum and maximum values, the x-axis increment is set at 2. Note that this input is optional.
6
Y Axis: The system will automatically pick a scale for the y-axis. However, if you would like to override that with your values for the y-axis, you can specify them here. The format for this input is to specify the minimum, increment, and maximum values separated by a semi-colon. For example, if you specify 10;20, the minimum y-axis scale is set at 10, and the maximum y-axis is set at 20. If you specify 10;2;20, then, in addition to minimum and maximum values, the y-axis increment is set at 2. Note that this input is optional.
7
Horizontal Lines: You can specify the values here if you want to add a few extra horizontal reference lines on top of your chart. The format for this input is numeric values separated by semi-colon. For example, if you specify 12;15, two horizontal lines are plotted at Y = 12 and Y = 15, respectively. Note that this input is optional.
8
Vertical Lines: You can specify the values here if you want to add a few extra vertical reference lines on top of your chart. The format for this input is numeric values separated by semi-colon. For example, if you specify 2;5, two vertical lines are plotted at X = 2 and X = 5, respectively. Note that this input is optional.

Verify

If you click the Verify button, the software will perform some checks on the data you entered. A sample screenshot of the dialog box is shown in the figure below. Verify The software checks if you have correctly specified the input options and entered the required data on the worksheet. The results of the analysis checks are listed on the right. If the checks are passed, they are shown as green-colored checkmarks. If the verification checks fail, they are shown as a red-colored cross. If the verification checks result in a warning, they are shown in the orange exclamation mark, and finally, any checks that are required to be performed by the user are shown as blue info icons.
1
Item: The left-hand side shows the major tabs and the items checked within each section
2
Status: The right-hand side shows the status of the checks.
3
Overall Status: The overall status of all the checks for the given analysis is shown here. The overall status check shows a green thumps-up sign if everything is okay and a red thumps-down sign if any checks have not passed. Note that you cannot proceed with generating analysis results for some analyses if the overall status is not okay.

Outputs

Click on Compute Outputs to update the output calculations. A sample screenshot of the worksheet with simple regression is shown below. outputs The analysis results are shown in the notes section. This includes the correlation coefficient between the output and input(s), the R^2 value of the fit, the ANOVA model between X and Y, and the model equation between the output and input(s). The graph includes a fitted line plot with the raw data points in blue and the model fit in red.

A histogram of the residuals for the run order and the fit values is also displayed. Make sure that the residuals are randomly distributed and that there is no pattern of the residuals concerning the run order or the fit value. If there are any problems with the residuals, you may need to revisit your regression model. outputs 2 If we perform a binary logistic regression, you may get an output similar to the one in the figure below. outputs 5 Example of diagnostic checks performed for the regression analysis and the show predictions area of the worksheet turned on. outputs 6

Regression Menu Bar

For Regression worksheets, an additional menu bar is displayed on the top main menu bar, as shown in the following screenshot: Regression Menu Bar If you don't see this menu bar when you are on a Regression worksheet, you can display it by clicking on the refresh button (#1 shown in the screenshot). The Make Predictions (#2) button will then be displayed.

Make Predictions

If you want to make individual predictions using the developed Regression model, you can use the Make Predictions menu on the top menu bar. Note that if you make many predictions and look at the confidence intervals, use the Show Predictions feature within the Analysis Setup to make the predictions. These inputs are entered directly on the worksheet, and you can use Compute Outputs to make predictions. However, if you want to use the model to predict individual values, you can use the Make Predictions dialog box. A sample screenshot of the results of the Make Predictions menu is shown in the figure below. Regression Predict 1
1
Model: The model analyzed in the current worksheet is displayed in this section. Note that if no model has been studied yet, you cannot make predictions using this dialog box. You will need first to generate a model using the Analysis Setup and Compute Outputs buttons. You can use a model to make predictions only when a model has been developed and saved to the worksheet.
2
Date: The date shows the date the model was developed and saved to the worksheet. Note that once a model has been saved, it can be used for predictions. You don't need to use Compute Outputs to update the model. You can share this worksheet with other users, and they can enter their inputs and generate the predicted model outputs using the model equation.
3
Inputs: Specify the input values you want to use to make the prediction. You will need to specify all the model inputs to make a prediction. A blank value of input will be taken as a value of 0.
4
Predict Button: Click on the >> button to make the prediction. This will use the model equation and the inputs you have specified to generate the model outputs.
5
Outputs: The outputs from the model are displayed in this section. Currently, the outputs are only displayed in this dialog box and not on the worksheet. You will need to manually copy the solution to your worksheet if you would like to save this value.
6
Cancel Button: Click on this button to close this dialog box.

Notes

Here are a few pointers regarding this analysis:
  • You can fit up to 30 factors with this worksheet.
  • Auto feature uses a stepwise-backward regression. The Auto functionality first fits a model with all the terms included. It then drops the terms with a P-value greater than the alpha value and re-fits the model. This process continues until only significant terms are left in the model.

Examples

The following examples are in the Examples folder.
  • For the data in the reference file, determine a statistically significant linear model between advertising spend and sales (Regression 1.xlsx).
  • For the data in the reference file, determine a statistically significant linear model between advertising spend, discounts, incentive program, and sales (Regression 1.xlsx).
  • For the data in the reference file, determine a statistically significant quadratic model between X and Y (Regression 1.xlsx).