## Simple Linear Regression Model: Free Economectrics Tutorial Using Stata 15

Contents

## Step by Step Guide to Estimate “Simple Linear Regression Model” Using Stata

This is a simple, easy to understand and step-by-step statistics tutorial on estimation of Simple Linear Regression Model using Stata 15 with youtube tutorial for better understanding and hands on practice session.

Simple linear regression model is a linear model with one independent variables which is represented by the following equation;

Where *y *is a dependent variable, *x* is an independent variable whereas, the *alpha, beta *and *epsilon* are the unknown parameters, ti be estimated. We estimate these parameters using simple linear regression model. Here our objective is not the discuss the theory of classical linear regression model, so, we will focus on practical, hands on, step-by-step method of estimation of these parameters. Therefore, we will use Stata to estimate the results of linear model.

### Step 1: Review of Data and Data Description

First of all we will import or open the data into the Stata. For this tutorial we are using the sample data of Principles of Econometrics, 4th edition (abbreviated as POE4). This sample file is availbale online, we may import this into Stata using following command;

use http://www.principlesofeconometrics.com/poe4/data/stata/food.dta

After imprinting, we study the data and enter following command for description of data;

describe

Then, you will get the following result;

Te above figure shows that there are two variables with 40 observations. Now, the next step is computing summary statistics.

### Step 2: Computing Summary Statistics of Data

Now, to check to summary statistics of data, on the pull-down menu of, click on

Statistics > Summaries, tables, and tests > Summary and descriptive statistics > Summary statistics. Or alternatively run the following stat command;

summarize

Then, we will get the following result;

These shows the default summary statistics like, mean, standard deviation, minimum and maximum values. However, we may get the detailed Summary Statistics we may add detail in option of the summarize command as;

summarize, detail

It will give detailed summary statistics. For instance if we enter in the command line;

summarize food_exp, detail

The, we get the detailed summary statistics of variable “Food Exp” as follows;

### Step 3: Plotting Scatter Diagram

Before going to run the simple linear regression model, we first look at data by plotting a scatter diagram so that we may come to know about apparent data story i.e apparently there seems some relationship between the two variables or not?

For this; on the Stata pull-down menu choose * Graphics > Twoway graph (scatter, line, etc.)* or alternatively you may enter following code:

twoway (scatter food_exp income)

Then, to save the graph in default local directory, use:

graph save food1, replace

Following option with code are available to plot:

twoway (scatter food_exp income), /// /* basic plot control */ ylabel(0(100)600) /// /* Y axis 0-600 & ticks at 100 */ xlabel(0(5)35) /// /* X axis 0-35 & ticks each 5 */ title(Food Expenditure Data) /* graph title */

And, you will get following graph:

Here you can review the data pattern which shows some positive relationship.

### Step 4: Estimating Simple Linear Regression

Regression analysis window can be access using the pull-down menu from * Statistics > Linear models and related > Linear regression *or through command line as under:

regress food_exp income

You will get the following results:

The above figure shows the results of ANOVA (F-Test), R-squared, Adjusted R-Squared, Individual T test, Coefficients etc.

© 2020 Dr Ghulam Mohey-ud-din, Senior Economist and Freelance Consultant from Lahore Pakistan.Last Updated on August 24, 2020

## 3 thoughts on “Simple Linear Regression Model: Free Economectrics Tutorial Using Stata 15”

## Economtrics Tutorial August 10, 2020 at 7:45 pm

This seems incomplete, please upload REMAINING. Waiting to learn more

Reply## admin August 11, 2020 at 4:08 pm

Yes, this is under progress, soon will be completed

Reply## admin August 30, 2020 at 10:04 pm

This Lecture is Complete Now, Youtube Lecture is also added

Reply