Learn R Programming

UPG (version 0.2.2)

logLik.UPG.Binomial: Compute log-likelihoods from UPG.Binomial objects

Description

logLik can be used to compute log-likelihoods from UPG.Binomial objects. The log-likelihood is based on the posterior mean of the coefficients and can be used for model selection when combined with,e.g., BIC or other model selection criteria.

Usage

# S3 method for UPG.Binomial
logLik(object = NULL, ...)

Arguments

object

an object of class UPG.Binomial.

...

other logLik parameters.

Value

Returns a numeric of class logLik with attributes containing the number of estimated parameters and the number of observations. Note that the number of observations in binomial models is equal to Ni and not equal to the sample size.

See Also

summary.UPG.Binomial to summarize the estimates of a discrete choice model from an UPG.Binomial object and create tables. plot.UPG.Binomial to plot the results of a discrete choice model from an UPG.Binomial object. coef.UPG.Binomial to extract coefficients from an UPG.Binomial object.

Examples

Run this code
# NOT RUN {
# estimate a binomial logit model using example data
library(UPG)
data(titanic)
y  = titanic[,1]
Ni = titanic[,2]
X  = titanic[,-c(1,2)]
results.binomial = UPG(y = y, X = X, Ni = Ni, type = "binomial")

# extract log-likelihood
ll.binomial = logLik(results.binomial)

# compute BIC
BIC(ll.binomial)
# }

Run the code above in your browser using DataLab