partial.prop.odds.mod: Run partial proportional odds models for ordinal outcomes

Description Usage Arguments Value Examples

View source: R/partial.prop.odds.mod.R

Description

This function runs partial proportional odds models for ordinal outcomes.

Usage

1
2
3
4
partial.prop.odds.mod(y.name, in.data, prop.odds.formula = NULL,
  beta.prop.odds.start = NULL, non.prop.odds.formula = NULL,
  beta.non.prop.odds.start = NULL, method = "BFGS",
  int.vec.scale = 5, itnmax = NULL, seed = c(14, 15))

Arguments

y.name

A character vector specifying the name of the variable to be modeled.

in.data

The input data object of type data frame or matrix.

prop.odds.formula

An optional formula specifying the predictor variables assumed to have proportional odds across levels of y. At least one of prop.odds.formula and non.prop.odds.formula must be specified.

beta.prop.odds.start

A vector of starting values for proportional odds betas. This should only be specified in conjunction with prop.odds.formula.

non.prop.odds.formula

An optional formula specifying the predictor variables assumed not to have proportional odds across levels of y. At least one of prop.odds.formula and non.prop.odds.formula must be specified.

beta.non.prop.odds.start

A matrix of starting values for non proportional odds betas. This should only be specified in conjunction with non.prop.odds.formula. Columns correspond to the j-1 bottom levels of the outcome variable y, rows correspond to variables.

method

A character specifying the optimization method to be used by package optimx in maximizing the log likelihood. Defaults to BFGS.

int.vec.scale

A tuning parameter used to adjust the starting values for the intercepts. Defaults to 5.

itnmax

An optional scalar specifying the iteration limit used in maximizing the log likelihood. Defaults to the default optimx value for the given method.

seed

A vector of length 2 specifying the seed used to generate starting values for model coefficients, if not user specified. Defaults to c(14, 15).

Value

A list of class partial.prop.odds

y.name

A character vector specifying the model outcome.

y.levels

The ordered levels of the model outcome.

prop.odds.formula

The formula used for the proportional odds betas.

non.prop.odds.formula

The formula used for the non-proportional odds betas.

log.lik

The log-likelihood of the fitted model.

conv.code

The convergence code from optimx.

intercepts

The fitted model intercepts

beta.hat.prop.odds

A vector of the estimated proportional odds coefficients, if specified.

beta.hat.non.prop.odds

A matrix of the estimated non-proportional odds coefficients, where the j-1 columns correspond to the j-1 bottom levels of y, and the rows are betas.

est.probs

The fitted probabilities of each level of y for each subject. Rows are subjects, columns are levels of y.

Examples

1
2
3
4
5
6
7
8
9
data(red_train)
starts <- coef(lm(quality ~ alcohol+ pH + volatile.acidity, data = red_train))
training.result <- partial.prop.odds.mod(y ="quality", in.data = red_train,
prop.odds.formula = ~ alcohol + pH,
beta.prop.odds.start = starts[2:3],
non.prop.odds.formula = ~ volatile.acidity,
beta.non.prop.odds.start = matrix(rep(starts[4], 5), nrow = 1),
method = "BFGS",
seed = c(14, 15), itnmax = 1000)

group-wine/sommelieR documentation built on May 21, 2019, 1:43 p.m.