13 Linear Regression

In this section you will find basic instructions for fitting simple and multiple regression models.

13.1 Simple Linear Regression

Instructions for fitting a s simple linear regression model in Rguroo:

  1. Use a dataset in your Rguroo account or recreate the example below by importing the cardata dataset from the Rguroo dataset repository called Rguroo Users Guide into your account.
Click here to see a portion of the dataset. Screenshot of the first 5 rows of the Cardata dataset.


  1. Open the Analytics toolbox on the left-hand side of the Rguroo window. Use the Analysis dropdown menu and choose Linear Regression —> Simple Regression. This will open the Simple Regression dialog box (see Figure 13.1)

  2. In the Data section, select a Dataset. Then select your predictor and response variables from the Predictor (x) and Response (y) dropdowns.

  3. (Optional) You can obtain predicted values and residuals by selecting the Predictions & Residuals (Observed data) checkbox. Moreover, you can get predictions for new values and perform tests of hypotheses about correlation and slope and obtain confidence intervals for parameters and mean predictions and prediction intervals using both theory-based and bootstrap methods.

  4. Click the Preview icon preview icon to view the result.

 =Simple regression dialog

Figure 13.1: Simple regression dialog

13.2 Multiple Linear Regression

Instructional video icon   Users guide icon

Instructions for fitting a multiple linear regression model in Rguroo:

  1. Use a dataset in your Rguroo account or recreate the example below by importing the cardata dataset from the Rguroo dataset repository called Rguroo Users Guide into your account.
Click here to see a portion of the dataset. Screenshot of the first 5 rows of the Cardata dataset.


  1. Open the Analytics toolbox on the left-hand side of the Rguroo window. Use the Analysis dropdown menu and choose Linear Regression —> Simple & Multiple Regression. This will open the Multiple Regression dialog box (see Figure 13.2).

  2. Select a Dataset.

  3. In the Model Specification section, select your response variable from the Response drop down.

  4. In the formula textbox, add your predictors. Predictors must be separated by a + sign. To get a model without an intercept, add -1 to your formula. See R documentation for details on how to specify models with interactions using “*” and “:”.

  5. (Optional) Click the Details button to add additional output, including model estimate and diagnostics graphs, diagnostic indices, fitted values, and prediction intervals.

  6. Click the Preview icon preview icon to view the result.

Multiple regression dialog

Figure 13.2: Multiple regression dialog

13.3 Regression Prediction Intervals

Instructional video icon

Instructions for obtaining prediction intervals in Rguroo:

  1. Use a dataset in your Rguroo account or recreate the example below by importing the AirPassengers dataset from the Rguroo dataset repository called R datasets into your account.
Click here to see a portion of the dataset. Screenshot of the first 5 rows of the Air Passenger dataset.


  1. Open the Analytics toolbox on the left-hand side of the Rguroo window. Use the Analysis dropdown menu and choose Linear Regression —> Simple & Multiple Regression. This will open the Multiple Regression dialog box (see Figure 13.3).

  2. Select a Dataset.

  3. In the Model Specification section, select your response variable from the Response dropdown.

  4. In the formula textbox, add your predictors. Predictors must be separated by a + sign. To get a model without an intercept, add -1 to your formula. See R documentation for details on how to specify models with interactions using “*” and “:”.

  5. Click the Details button and select the Fitted Values, Predictions, and Interval Estimates tab. Here, move Prediction Interval to the Selected column using drag-and-drop or the menu arrows.

  6. Check one or both of the options Internal Data or External Data. Internal data refers to cases that are used to fit the model. External data refers to cases that are not used to fit the model. You specify the external data by adding them to your dataset and setting the response variable column for these cases to NA.

  7. Click the Preview icon preview icon to view the result.

Regression Prediction Intervals dialog

Figure 13.3: Regression Prediction Intervals dialog