| twopartm-class | R Documentation | 
twopartmA fitted two-part regression model by tpm.
formula_part1Formula specified for the first-part model, i.e., the binomial model for indicators about any non-zero responses.
formula_part2Formula specified for the second-part model, i.e., the glm model for non-zero responses.
dataData set used to fit the two-part model. It's the same data set as the data argument in tpm.
n:Number of observations used in the two-part model (with weights > 0).
n_part1Number of of observations used in the first-part model (with weights > 0), i.e., the binomial model for indicators about any non-zero responses.
n_part2Number of of observations used in the second-part model (with weights > 0), i.e., the glm model for non-zero responses.
data_model1The model frame for the first-part model, i.e., the binomial model for indicators about any non-zero responses.
data_model2The model frame for the second-part model, i.e., the glm model for non-zero responses.
model_part1An object of class glm of the fitted first-part model,  i.e., the binomial model for indicators about any non-zero responses.
model_part2An object of class glm of the fitted second-part model,  i.e.,  the glm model for non-zero responses.
link_part1Character string describing the link function of the first-part model, i.e., the binomial model for indicators about any non-zero responses.
family_part2The family object used in the second-part model, i.e., the glm model for non-zero responses.
weightsA vector of weights used in the two-part model fitting, or NULL if no weights used.
fittedFitted mean values by the two-part model, obtained by multiplying the fitted probabilities of non-zero responses and the fitted means of non-zero responses.
residualsA vector of raw residuals (observed - fitted).
loglikLog-likelihood values of the fitted two-part model.
yThe response vector.
Yajie Duan, Birol Emir, Griffith Bell and Javier Cabrera
tpm, AME, margin, glm
##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(formula_part1 = exp_tot~female+age, formula_part2 = exp_tot~female+age+ed_colplus, data = meps,link_part1 = "logit",family_part2 = Gamma(link = "log")) ##get the formula specified for the first-part model tpmodel@formula_part1 ##get the formula specified for the second-part model tpmodel@formula_part2 ##get the log-likelihood for the fitted two-part model tpmodel@loglik ##get the fitted glm model for the first part tpmodel@model_part1 ##get the fitted glm model for the second part tpmodel@model_part2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.