Learn R Programming

twopartm (version 0.1.0)

logLik-methods: Method for Function logLik for Two-part Model Objects in Package twopartm

Description

The logLik method for twopartm-class that extracts log-likelihood from a fitted two-part regression model object of class twopartm.

Usage

# S4 method for twopartm
logLik(object,...)

Value

Returns an object of class logLik for model object twopartm.This is a number with at least one attribute, "df" (degrees of freedom), giving the number of (estimated) parameters in the two-part model.

Arguments

object

a fitted two-part model object of class twopartm as returned by tpm.

...

arguments passed to logLik in the default setup.

Author

Yajie Duan, Birol Emir, Griffith Bell and Javier Cabrera

Details

The logLik method for twopartm-class returns an object of class logLik, including the log likelihood value with degree of freedom of a fitted two-part regression model object of class twopartm.

References

Belotti, F., Deb, P., Manning, W.G. and Norton, E.C. (2015). twopm: Two-part models. The Stata Journal, 15(1), pp.3-20.

Harville, D.A. (1974). Bayesian inference for variance components using only error contrasts. Biometrika, 61, 383–385. doi: 10.2307/2334370.

See Also

twopartm-class, glm,logLik.lm, tpm

Examples

Run this code

##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)

##log-likehood
logLik(tpmodel)

Run the code above in your browser using DataLab