predict: Predict method for MGLM Fits

predictR Documentation

Predict method for MGLM Fits

Description

Predict using the fitted model from MGLMreg when given a new set of covariates.

Usage

## S4 method for signature 'MGLMreg'
predict(object, newdata)

Arguments

object

model object.

newdata

new covariates data matrix.

Value

Outputs the probabilities of each category.

This helps answer questions such as whether certain features increase the probability of observing category j.

Examples

n <- 200
p <- 5
d <- 4
X <- matrix(runif(p * n), n, p)
alpha <- matrix(c(0.6, 0.8, 1), p, d - 1, byrow=TRUE)
alpha[c(1, 2),] <- 0
Alpha <- exp(X %*% alpha) 
beta <- matrix(c(1.2, 1, 0.6), p, d - 1, byrow=TRUE)
beta[c(1, 2),] <- 0
Beta <- exp(X %*% beta)
m <- runif(n, min=0, max=25) + 25
Y <- rgdirmn(n, m, Alpha, Beta)
gdmReg <- MGLMreg(Y~0+X, dist="GDM")
newX <- matrix(runif(1*p), 1, p)
pred <- predict(gdmReg, newX)


MGLM documentation built on April 14, 2022, 1:07 a.m.