

I’m trying to teach students about regression by having them produce some scatterplots at the same time they run a series of linear regressions. I’m trying to keep the syntax as simple as possible, and also trying to show them how to start in the menu and then create syntax using the paste function. Selecting Analyze>Regression>Linear>Plot permits one to plot Y against X, but permits only a narrow selection of variables that can be included in the scatterplot from the Plots window. These are the Dependent Variable and different types of predicted values and residuals. …but the original IV/X variable isn’t there on the list in the Plots window. If I select an arbitrary variable for X within the plot window (e.g., * DRESID) and I paste that syntax I get something like this (simplified): Regression /Dependent Y /Method=Enter X /Scatterplot = (Y, *DRESID) . If I alter the Scatterplot option to have the original X variable plotted against Y like the code below, all works fine and the students can see the scatterplot of X/Y along with all standard regression output.: Regression /Dependent Y /Method=Enter X /Scatterplot = (Y, X) . …but If I try to replace X with any other variable in the dataset for illustration purposes (e.g., manually calculated predicted values), I get an error message. I realize that I can get a scatterplot of any two variables by using Graphs>Legacy Dialogs>Scatter/Dot, but this just adds more to what the students need to learn and doesn’t provide all regression output. Question – is there anyway to run a scatterplot of Y with some other variable in the dataset (like manuallycalculated predicted values or previously saved predicted values) with a regression command option or do I need to do this with a second set of commands? Remember, I’m trying to keep this as simple as possible for consumption by students who are a bit math phobic. Thanks in advance, Jeff
=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD


You can expand the plotting options in REGRESSION by using the VARIABLES subcommand, although this is not supported in the dialog box. Here is an example. Note that the list must include all the variables in the regression along with the extra variables you want to use in a plot, and that with listwise missing values, all the variables on the VARIABLES subcommand will be considered.
REGRESSION /VARIABLES salbegin bdate salary jobtime minority /DEPENDENT salary /METHOD=ENTER jobtime minority /SCATTERPLOT=(*ZRESID ,*ZPRED) (salbegin bdate).
You can check the "Produce all partial plots" box in the Plots subdialog to get all the partial plots.
Another procedure that you might find useful here is Graphs > Regression Variable Plots (STATS REGRESS PLOT). This gives you a compact way to see a bunch of plots with or without various types of regression lines along with appropriate categorical plots for categorical variables. The scatters can be colored, sized, or have symbols set by categorical variables, and the points can be labelled.
This extension command can be installed via the Extensions > Extension Hub menu if it is not already installed (check the Visualization box and/or regress in the search field and search).
I’m trying to teach students about regression by having them produce some scatterplots at the same time they run a series of linear regressions. I’m trying to keep the syntax as simple as possible, and also trying to show them how to start in the menu and then create syntax using the paste function. Selecting Analyze>Regression>Linear>Plot permits one to plot Y against X, but permits only a narrow selection of variables that can be included in the scatterplot from the Plots window. These are the Dependent Variable and different types of predicted values and residuals. …but the original IV/X variable isn’t there on the list in the Plots window. If I select an arbitrary variable for X within the plot window (e.g., * DRESID) and I paste that syntax I get something like this (simplified): Regression /Dependent Y /Method=Enter X /Scatterplot = (Y, *DRESID) . If I alter the Scatterplot option to have the original X variable plotted against Y like the code below, all works fine and the students can see the scatterplot of X/Y along with all standard regression output.: Regression /Dependent Y /Method=Enter X /Scatterplot = (Y, X) . …but If I try to replace X with any other variable in the dataset for illustration purposes (e.g., manually calculated predicted values), I get an error message. I realize that I can get a scatterplot of any two variables by using Graphs>Legacy Dialogs>Scatter/Dot, but this just adds more to what the students need to learn and doesn’t provide all regression output. Question – is there anyway to run a scatterplot of Y with some other variable in the dataset (like manuallycalculated predicted values or previously saved predicted values) with a regression command option or do I need to do this with a second set of commands? Remember, I’m trying to keep this as simple as possible for consumption by students who are a bit math phobic. Thanks in advance, Jeff
=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD


The Variables subcommand does the trick. Thanks Jeff From: Jon Peck <[hidden email]> Sent: Monday, April 1, 2019 5:40 AM To: Jeff <[hidden email]> Cc: SPSS List <[hidden email]> Subject: Re: [SPSSXL] Scatterplots with Regression Syntax You can expand the plotting options in REGRESSION by using the VARIABLES subcommand, although this is not supported in the dialog box. Here is an example. Note that the list must include all the variables in the regression along with the extra variables you want to use in a plot, and that with listwise missing values, all the variables on the VARIABLES subcommand will be considered. /VARIABLES salbegin bdate salary jobtime minority /METHOD=ENTER jobtime minority /SCATTERPLOT=(*ZRESID ,*ZPRED) (salbegin bdate). You can check the "Produce all partial plots" box in the Plots subdialog to get all the partial plots. Another procedure that you might find useful here is Graphs > Regression Variable Plots (STATS REGRESS PLOT). This gives you a compact way to see a bunch of plots with or without various types of regression lines along with appropriate categorical plots for categorical variables. The scatters can be colored, sized, or have symbols set by categorical variables, and the points can be labelled. This extension command can be installed via the Extensions > Extension Hub menu if it is not already installed (check the Visualization box and/or regress in the search field and search). I’m trying to teach students about regression by having them produce some scatterplots at the same time they run a series of linear regressions. I’m trying to keep the syntax as simple as possible, and also trying to show them how to start in the menu and then create syntax using the paste function. Selecting Analyze>Regression>Linear>Plot permits one to plot Y against X, but permits only a narrow selection of variables that can be included in the scatterplot from the Plots window. These are the Dependent Variable and different types of predicted values and residuals. …but the original IV/X variable isn’t there on the list in the Plots window. If I select an arbitrary variable for X within the plot window (e.g., * DRESID) and I paste that syntax I get something like this (simplified): Regression /Dependent Y /Method=Enter X /Scatterplot = (Y, *DRESID) . If I alter the Scatterplot option to have the original X variable plotted against Y like the code below, all works fine and the students can see the scatterplot of X/Y along with all standard regression output.: Regression /Dependent Y /Method=Enter X /Scatterplot = (Y, X) . …but If I try to replace X with any other variable in the dataset for illustration purposes (e.g., manually calculated predicted values), I get an error message. I realize that I can get a scatterplot of any two variables by using Graphs>Legacy Dialogs>Scatter/Dot, but this just adds more to what the students need to learn and doesn’t provide all regression output. Question – is there anyway to run a scatterplot of Y with some other variable in the dataset (like manuallycalculated predicted values or previously saved predicted values) with a regression command option or do I need to do this with a second set of commands? Remember, I’m trying to keep this as simple as possible for consumption by students who are a bit math phobic. Thanks in advance, Jeff ===================== To manage your subscription to SPSSXL, send a message to [hidden email] (not to SPSSXL), with no body text except the command. To leave the list, send the command SIGNOFF SPSSXL For a list of commands to manage subscriptions, send the command INFO REFCARD

=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD

