In this article
In this example we have a simple data set containing 10 records, where for each respondent we have a value for Income and a value for Job Satisfaction .
Figure 1 - Example of a simple data set with 10 records
Assume we wish to discover if there is a linear relationship between Income and Job Satisfaction. To do this we can create a Linear Regression:
- In the Analyst toolbox, expand the Advanced Analytics item (if necessary), right-click on the Linear Regression folder and select Insert Linear Regression Inside .
- Dependent variable - This field will contain the variable to be analyzed by linear regression analysis. The variable will as a result of the analysis be expressed as a linear function of the independent variables. The field can contain only one variable, and this variable must be numeric. The supported question types are: Numeric, Numeric List, Single with numeric codes/scale and Grid elements with numeric scale. Drag and drop a question from the Data Source toolbox to populate the field.
- Independent variables - This field will contain the variables that will be used to explain the dependent variable, as a linear function. The field can contain one or more variables, and the variables must all be numeric. The supported questiontypes are: Numeric, Numeric List, Single with numeric codes/scale and Grid elements with numeric scale. Drag and drop one or more questions from the Data Source toolbox to populate the field.
- Filter - This field may contain a filter to restrict the underlying dataset the linear regression analysis is performed on. The field can contain only filters of type Filter Expression. Drag and drop a filter expression to populate the field. The filter expression can be reviewed or edited by clicking the "..." button.
- Minimum number of Cases - use this field to specify a minimum number of cases (data rows) that must be available to run the multivariate calculation. The default value is 0, so there is no lower limit. If the number of available cases in the calculation is less than the specified limit, an error message will be displayed.
- Case selection - this setting specifies how calculations are to be handled if the number of available cases (data rows) exceeds the system limit for the maximum number of cases allowed in multivariate calculations. The limit is 10.000 data rows. The options are:
- Default - The last 10.000 of the available data rows will be used. This corresponds to the latest collected data.
- Random - A random subset containing 10.000 of the available data rows will be used.
- First - The first 10.000 of the available data rows will be used. This corresponds to the earliest collected data.
- Data selection - specifies which data values are to be used for categorical variables in the multivariate calculation. The options are:
- Codes - The variables' answer codes will be used. This requires the codes to be numerical.
- Scores - The variables' answer scores will be used. This requires the answer scores to be specified. Any answers with missing scores will be omitted by list-wise deletion in the calculation.
- From the report's Data Source toolbox, drag the two variables that are to be the Dependent and Independent Variables (in this case the satisfaction question and the income question respectively), and drop them into the appropriate fields .
- When the variables are in place, click Run Linear Regression.
- Click the Show/Hide Chart button in the lower-left corner of the area.
Figure 2 - Creating a new Linear Regression object
A new Linear Regression object is created in the folder and the Model Designer page opens .
Figure 3 - The Linear Regression Model Designer page
The fields are as follows:
Note: Linear Regression does not support parameters, so any parameters used in the filter expression will be ignored and should instead be written as explicit expressions.
Advanced Settings:
The Data Selection setting is also available when executing a dynamic regression via scripting.
Note: The variables used must be Numeric variables or variables that contain a scale.
Figure 4 - The Satisfaction and Income variables in place
Note that several variables can be added to the Independent Variables field, and you can add a filter so you can view a sub-set of the data if required.
The calculations are run and the results are presented in the area below the Model frame . (go to Regression Data for more information).
Figure 5 - The results in tabular form
Each time a run is performed, a header row of information is presented above the results of that run. This header row gives the Run Number and the date and time of the run, and lists which variables were used in the run. This allows the user to conduct experiments using different variables and filters etc. and return to the most useful results later. Click in a header row to expand or contract that run's results.
Note: The tables and chart are created using the data available at the time of the run; they are not updated if more data becomes available. To include new data, re-run the regression.
For simple regressions you can also create a scatter chart:
A chart is displayed below the data tables .
Figure 6 - The chart created from the example data
A two-variable regression gives a "best fit" line through the data, and the equation that defines the line. The data from the tables and chart tells us:
- The "start point" for the job satisfaction is 13.4%
- For every $10000 extra that an employee receives, their job satisfaction increases by 7.15 percentage points.
- The Model Summary table gives an R2 value of 0.9. R2 is the "effect", so in this example 90% of Job Satisfaction can be explained by salary.
Click the Send to Excel button to export the tables to Excel.