Learn R Programming

OrdLogReg (version 1.1)

Ord.logreg: Ordinal Logic Regression

Description

Constructs an ordinal logic regression model for identification of binary predictors and predictor interactions for an ordinal response

Usage

Ord.logreg(resp, Xs, nleaf, use.cv = TRUE, kfold = 5, anneal.params)

Arguments

resp
vector of ordinal response values. Note the reference cateogry should be assigned a value of 0.
Xs
matrix or data frame of zeros and ones for all predictor variables.
nleaf
numeric value or vector. If use.cv=FALSE, nleaf can be either a single numeric value or vector (length is the number of categories -1). A single value means that the maximum possible number of leaves in all trees will be "nleaf". The default value is 8 when use.cv=FALSE. If use.cv=TRUE, nleaf is a vector of the minimum and maximum values to be cosidered in the trees. The default value is c(1,8).
use.cv
logical. If use.cv=TRUE, cross-validation will be used to determine the best choice of model size for each tree inteh ordinal logic regression model.
kfold
If use.cv=TRUE, kfold is the number of times the data are to be split during cross-validation to determine appropriate tree size. Note, if use.cv=FALSE, this arguement will be ignored.
anneal.params
a list containing the parameters for simulated annealing. See the help file for the function logreg.anneal.control in the LogicReg package. If missing, default annealing parameters are set at start=1, end=-2, and iter=50000.

Value

"Ord.logreg" which is a list including values
mod.dat
For data with K response categories, a list of the K-1 predictor datasets used to fit each logic regression tree in the model.
model
A list of K-1 logic regression trees associated with the largest K-1 response categories.
Ys
A list of the K-1 binary response vectors (based on the original ordinal response) generated to fit each of the K-1 logic regression trees.
mod.preds
A vector containing the names of the predictors used in each of teh K-1 logic regression trees.
pos
A vector of indicators of whether or not a predictor in an individial tree represents a predictor or its compliment. A value of 1 indicates that the predictor occurs as the compliment.
leaves
A vector of the maximum number of leaves used for each of the K-1 logic regression trees.
CV
A statement describing if cross-validation was used.

See Also

print.Ord.logreg, predict.Ord.logreg, plot.Ord.logreg

Examples

Run this code
data(OLRdata)


#typically >25000 would be used for the annealing algorithm.  
#Number of iterations here is set to 2500 for faster run time
#Fitting model without cross-validation
cont<-logreg.anneal.control(start=1, end=-2, iter=2500)
Xs<-OLRdata[,c(1:50)]
Ys<-OLRdata$Y
OLRmod1<-Ord.logreg(resp=Ys, Xs=Xs, use.cv=FALSE, anneal.params=cont)
print(OLRmod1)

#Fitting a model without cross-validation but setting the maximum number of leaves per tree
OLRmod2<-Ord.logreg(resp=Ys, Xs=Xs, nleaf=c(3,4,3), use.cv=FALSE, anneal.params=cont)
print(OLRmod2)

#Fitting model with cross-validation
OLRmod3<-Ord.logreg(resp=Ys, Xs=Xs, use.cv=TRUE, anneal.params=cont)
print(OLRmod3)

Run the code above in your browser using DataLab