Twoway prediction plots
twoway estfit yvar xvar [weight] [if exp] [in range] [, estcmd(command name) lfit_options]
estcmd(estimation command name) specifies the name of the Stata estimation command to use for fitting the model and creating the prediction line
lfit_options are any options allowed by twoway_lfit. The estopts and predopts now apply to whatever command is specified in estcmd
Description
twoway estfit is a more flexible alternative to (cmd: lfit} -- it calculates and plots the prediction line from fitting yvar on xvar using the model specified in estcmd. For more detailed syntax and help see twoway_lfit,
estfit only differs from lfit because it allows you to specify a different estimator rather than regress that is built into lfit.
Options
estcmd(estimation command name) specifies the name of the command to be run to estimate the model from which the line will be predicted. Choices include any Stata command that can be run using the the y and x vars. Common applications could include rreg or qreg for more robust linear fits than lfit provides, but can be any command that works with predict such as logit, probit, poisson, glm, or even user-written non-linear or maximum likelihood models.
estopts(model_options) as in lfit, specifies options to be passed along to estcmd to estimate the model.
predopts(predict_options) as in lfit, specifies options to be passed along to predict to obtain the predictions after estimation by estcmd.
Typical use
twoway estfit, like lfit, is primarily used in conjunction with other twoway plottypes, such as
. sysuse auto, clear
. scatter mpg weight || estfit mpg weight, estcmd(qreg)
Results are the same as typing
. qreg mpg weight . predict fitted . scatter mpg weight || line fitted weight
Also see
Manual: [G] graph twoway lfit
Online: help for twoway_lfit; twoway_qfit, twoway_fpfit, twoway_mband, twoway_mspline; twoway_lfitci;