Hello everyone,
As a follow-up to my previous question on regression, I'm now trying to plot fitted values.
Basically, I've done a regression on a variable called YearlyEarnings using 6 independent variables:
and now I would like to plot the fitted values generated from the results of the regression. This is what I'm unsure about how to do it though. I've tried using the predict command:
and then plotting that over my potexp variable:
This however produces a gazillion lines for me, which I assume is logical but unwanted. Logical because of (correct me if I'm wrong) the 6 independent variables but unwanted as I only want to see 1 line, the mean. Please find attached an image of the graph it is creating for at the moment.
To elaborate, as you can see from my regression command, I'm running it for those observations for which status is equal to 0. Status is a variable that can take values of 0 and 1, and I actually want to have a graph that shows fitted values for both groups, to be able to compare them. I want to have the YearlyEarnings on the y-axis and potexp on the x-axis.
I've been reading up on several commands, including -coefplot-, -lgraph- but I don't seem to get there.
In order to make helping me easier, I figured I'd use the 1978 automobile dataset as an example. These are the commands I've used there:
This produces a graph like the second attachment, which is similar to the one produced for my own dataset. If anyone could tell me how to properly plot the fitted values for when foreign is equal to 0 and when foreign is equal to 1, I'm sure I can translate it to my own data.
Thanks very much in advance. If anything remains unclear, please tell.
As a follow-up to my previous question on regression, I'm now trying to plot fitted values.
Basically, I've done a regression on a variable called YearlyEarnings using 6 independent variables:
Code:
reg YearlyEarnings age88 age88sq civstatus education potexp potexpsq if status==0
Code:
predict fitted_values
Code:
line fitted_values potexp
To elaborate, as you can see from my regression command, I'm running it for those observations for which status is equal to 0. Status is a variable that can take values of 0 and 1, and I actually want to have a graph that shows fitted values for both groups, to be able to compare them. I want to have the YearlyEarnings on the y-axis and potexp on the x-axis.
I've been reading up on several commands, including -coefplot-, -lgraph- but I don't seem to get there.
In order to make helping me easier, I figured I'd use the 1978 automobile dataset as an example. These are the commands I've used there:
Code:
reg price mpg trunk weight length if foreign==0 predict fitted_values line fitted_values mpg
Thanks very much in advance. If anything remains unclear, please tell.
Comment