Originally posted by Raymond Zhang
View Post
I was wondering if you could inform me whether it is possible to replace the scatter plot in the last part of your command (scatter mpg displacement if foreign==1,sort) with a Component-plus-residual plot. The reason for this is I have multiple independent variables in MFP and the scatter plot does not take into account the effect of the other independent variables in the model.
This is what I did base on your commands:
mfp: regress mpg weight displacement if foreign==0
fracplot displacement
mfp, center(no): regress mpg weight displacement if foreign==1
fracpred dfit, for(displacement)
fracpred ds, for(displacement) s
gen low=dfit-1.96*ds
gen high=dfit+1.96*ds
addplot: rarea low hi displacement ,color(gs14%80) sort || line dfit displacement ,color(red) || cprplot displacement if foreign==1,sort
The STATA's output is an error indicating that "cprplot is not a twoway plot type".
Also, although I did not centerized the independent variables in the regression model, the Y axis shows value in the compontnt-plus residual value.'
Please let me know what you think. Thank you
Comment