mlogit: Class 'mlogit'

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/mlogit.R

Description

These functions can be used to fit a binomial logistic regression model that has a random intercept to clustered observations. Observations in each cluster are assumed to have the same intercept, while different clusters may have different intercepts. This is a mixed-effects problem.

Usage

1
2
mlogit(x)
rmlogit(k, gi=2, ni=2, pt=0, pr=1, beta=1, X)

Arguments

x

a numeric matrix with four or more columns that stores clustered data.

k

the number of groups or clusters.

gi

a numeric vector that gives the sample size in each group.

ni

a numeric vector for the number of Bernoulli trials for each observation.

pt

a numeric vector for all the support points.

pr

a numeric vector for all the probabilities associated with the support points.

beta

a numeric vector for the fixed coefficients of the covariates of the observation.

X

the numeric matrix as the design matrix. If missing, a random matrix is created from a normal distribution.

Details

Class mlogit is used to store data for fitting the binomial logistic regression model with a random intercept.

Function mlogit creates an object of class mlogit, given a matrix with four or more columns that stores, respectively, the group/cluster membership (column 1), the number of ones or successes in the Bernoulli trials (column 2), the number of the Bernoulli trials (column 3), and the covariates (columns 4+).

Function rmlogit generates a random sample that is saved as an object of class mlogit.

An object of class mlogit contains a matrix with four or more columns, that stores, respectively, the group/cluster membership (column 1), the number of ones or successes in the Bernoulli trials (column 2), the number of the Bernoulli trials (column 3), and the covariates (columns 4+).

It also has two additional attributes that facilitate the computing by function cmmms. The first attribute is ui, which stores the unique values of group memberships, and the second is gi, the number of observations in each unique group.

It is convenient to use function mlogit to create an object of class mlogit.

Author(s)

Yong Wang <yongwang@auckland.ac.nz>

References

Kiefer, J. and Wolfowitz, J. (1956). Consistency of the maximum likelihood estimator in the presence of infinitely many incidental parameters. Ann. Math. Stat., 27, 886-906.

Wang, Y. (2010). Maximum likelihood computation for fitting semiparametric mixture models. Statistics and Computing, 20, 75-86.

See Also

nnls, cnmms.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
x = rmlogit(k=30, gi=3:5, ni=6:10, pt=c(0,4), pr=c(0.7,0.3),
           beta=c(0,3))    
cnmms(x)

### Real-world data
# Random intercept logistic model
data(toxo)
cnmms(mlogit(toxo))

data(betablockers)
cnmms(mlogit(betablockers))

data(lungcancer)
cnmms(mlogit(lungcancer))

nspmix documentation built on Oct. 23, 2020, 6:46 p.m.

Related to mlogit in nspmix...