simulate.brmultinom: Method for simulating a data set from '"brmultinom"' and...

View source: R/brmultinom.R

simulate.brmultinomR Documentation

Method for simulating a data set from "brmultinom" and "bracl" objects

Description

Method for simulating a data set from "brmultinom" and "bracl" objects

Usage

## S3 method for class 'brmultinom'
simulate(object, ...)

Arguments

object

an object of class "brmultinom" or "bracl".

...

currently not used.

Value

A "data.frame" with object$ncat times the rows that model.frame(object) have and the same variables. If weights has been specified in the call that generated object, then the simulate frequencies will populate the weights variable. Otherwise, the resulting data.frame will have a ".weights" variable with the simulated multinomial counts.

Examples


## Multinomial logistic regression
data("housing", package = "MASS")
houseML1 <- brmultinom(Sat ~ Infl + Type + Cont, weights = Freq,
                       data = housing, type = "ML", ref = 1)
simulate(houseML1)

## Adjacent-category logits
data("stemcell", package = "brglm2")
stemML1 <- bracl(research ~ religion + gender, weights = frequency,
                data = stemcell, type = "ML")

simulate(stemML1)


brglm2 documentation built on Oct. 12, 2023, 1:07 a.m.