![]() A sample of 74 cars was used in the analysis. Here is an example of how to do so:Ī linear regression was performed to quantify the relationship between the weight of a car and its miles per gallon. Lastly, we want to report the results of our simple linear regression. For example, a car that weighs 4,000 pounds is predicted to have mpg of 15.405: We can use this equation to find the predicted mpg for a car, given its weight. ![]() Regression Equation: Lastly, we can form a regression equation using the two coefficient values. In this case, since this value is less than 0.05, we can conclude that there is a statistically significant relationship between weight and mpg. This is the p-value associated with the test statistic for weight. This doesn’t actually make much sense to interpret since the weight of a car can’t be zero, but the number 39.44028 is needed to form a regression equation. 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. |