In this example, the average mpg is 39.44028 when the weight of a car is zero. This tells us the average value of the response variable when the explanatory variable is zero. In this example, each one pound increase in weight is associated with a decrease of 0.006 in mpg, on average.Ĭoef (_cons): 39.44028. This tells us the average change in the response variable associated with a one unit increase in the explanatory variable. In this example, 65.15% of the variation in mpg can be explained by weight.Ĭoef (weight): -0.006. R-squared: 0.6515. This is the proportion of the variance in the response variable that can be explained by the explanatory variable. Here is how to interpret the most interesting numbers in the output: Type the following into the Command box to perform a simple linear regression using weight as an explanatory variable and mpg as a response variable. Step 4: Perform simple linear regression. To quantify this relationship, we will now perform a simple linear regression. We can see that cars with higher weights tend to have lower miles per gallon. Type the following into the Command box to create a scatterplot: mpg so we can visualize the relationship between these two variables and check for any obvious outliers. We can see that there are 12 different variables in the dataset, but the only two that we care about are mpg and weight.īefore we perform simple linear regression, let’s first create a scatterplot of weight vs. Gain a quick understanding of the data you’re working with by typing the following into the Command box: Load the data by typing the following into the Command box: Perform the following steps in Stata to conduct a simple linear regression using the dataset called auto, which contains data on 74 different cars. Suppose we are interested in understanding the relationship between the weight of a car and its miles per gallon. To explore this relationship, we can perform simple linear regression using weight as an explanatory variable and miles per gallon as a response variable. Example: Simple Linear Regression in Stata This tutorial explains how to perform simple linear regression in Stata. Simple linear regressionis a method you can use to understand the relationship between an explanatory variable, x, and a response variable, y.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |