plot-methods | R Documentation |
plot
for Two-part Model Objects in Package twopartmThe plot
method for twopartm-class
that provides plot diagnostics for a fitted two-part regression model object of class twopartm
.
## S4 method for signature 'twopartm,missing' plot(x, y, ...)
x |
an object of class |
y |
not used. |
... |
arguments passed to |
The plot
method for twopartm-class
returns the residual plot for the full two-part model, and also six plots for each part's glm model. Six plots are: a plot of residuals against fitted values, a Scale-Location plot of sqrt(| residuals |) against fitted values, a Normal Q-Q plot, a plot of Cook's distances versus row labels, a plot of residuals against leverages, and a plot of Cook's distances against leverage/(1-leverage). By default, the first three plots and the fifth one of each part's model are provided. The plots for each part's model could be selected by argument which
of function plot.lm
for glm model object.
Returns residual plot for the full two-part model, and plot diagnostics for each part's model from an object twopartm
.
Yajie Duan, Birol Emir, Griffith Bell and Javier Cabrera
Belotti, F., Deb, P., Manning, W.G. and Norton, E.C. (2015). twopm: Two-part models. The Stata Journal, 15(1), pp.3-20.
Belsley, D. A., Kuh, E. and Welsch, R. E. (1980). Regression Diagnostics. New York: Wiley.
Cook, R. D. and Weisberg, S. (1982). Residuals and Influence in Regression. London: Chapman and Hall.
twopartm-class
, glm
,plot.lm
, tpm
##data about health expenditures, i.e., non-negative continuous response data(meps,package = "twopartm") ##fit two-part model with the same regressors in both parts, with logistic ##regression model for the first part, and glm with Gamma family with log ##link for the second-part model tpmodel = tpm(exp_tot~female+age, data = meps,link_part1 = "logit", family_part2 = Gamma(link = "log")) tpmodel ##summary information summary(tpmodel) ##plots for two-part model plot(tpmodel)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.