Package 'clogitboost'

Title: Boosting Conditional Logit Model
Description: A set of functions to fit a boosting conditional logit model.
Authors: Haolun Shi and Guosheng Yin
Maintainer: Haolun Shi <[email protected]>
License: GPL (>= 2)
Version: 1.1
Built: 2025-03-25 03:03:42 UTC
Source: https://github.com/cran/clogitboost

Help Index


Boosting conditional logit model

Description

Fit a boosting conditional logit model using componentwise smoothing spline.

Usage

clogitboost(y, x, strata, iter, rho)

Arguments

y

vector of binary outcomes.

x

matrix or data frame with each column being a covariate.

strata

vector of group membership, i.e., items in the same group have the same value.

iter

number of iterations.

rho

learning rate parameter in the boosting algorithm.

Value

The function clogitboost returns the following list of values:

call

original function call.

func

list of fitted spline functions.

index

list of indices indicating which covariate is used as input for the smoothing spline.

theta

list of fitted coefficients in the conditional logit models.

loglike

sequence of fitted values of log-likelihood.

infscore

relative influence score for each covariate.

rho

learning rate parameter, which typically takes a value of 0.05 or 0.1.

xmax

maximal element of each covariate.

xmin

minimal element of each covariate.

Author(s)

Haolun Shi [email protected]

Guosheng Yin [email protected]

See Also

plot.clogitboost

predict.clogitboost

Examples

data(travel)
train <- 1:504
y <- travel$MODE[train]
x <- travel[train, 3:6]
strata <- travel$Group[train]
fit <- clogitboost(y = y, x = x, strata = strata, iter = 10, rho = 0.05)

Marginal utility for clogitboost objects

Description

marginal function for the clogitboost objects, which produces the marginal utility values of a covariate.

Usage

marginal(x, grid, d)

Arguments

x

output object from the clogitboost function.

d

integer indicating which covariate is used.

grid

grid of values for predicting the marginal utilities.

Value

The method marginal returns a vector of predicted marginal utilities based on the grid input.

Author(s)

Haolun Shi [email protected]

Guosheng Yin [email protected]

See Also

clogitboost

Examples

data(travel)
train <- 1:504
y <- travel$MODE[train]
x <- travel[train, 3:6]
strata <- travel$Group[train]
fit <- clogitboost(y = y, x = x, strata = strata, iter = 10, rho = 0.05)
marginal(fit, grid = seq(0, 10, by = 1), d = 1)

Plotting after fitting a boosting conditional logit model

Description

plot methods for the clogitboost objects, which produce marginal plots of the covariate effects.

Usage

## S3 method for class 'clogitboost'
plot(x, d, grid = NULL, ...)

Arguments

x

output object from the clogitboost function.

d

integer indicating which covariate is used.

grid

grid of values for plotting. If it is not specified, the minimal and maximal elements of the covariate are used as the two endpoints of the grid.

...

other options for plotting.

Author(s)

Haolun Shi [email protected]

Guosheng Yin [email protected]

See Also

clogitboost

Examples

data(travel)
train <- 1:504
y <- travel$MODE[train]
x <- travel[train, 3:6]
strata <- travel$Group[train]
fit <- clogitboost(y = y, x = x, strata = strata, iter = 10, rho = 0.05)
plot(fit, d = 1, xlab = "x", ylab = "f(x)", main = "TTIME", type = "l")

Predicting after fitting a boosting conditional logit model

Description

predict methods for the clogitboost objects, which produce marginal predictions of the covariate effects.

Usage

## S3 method for class 'clogitboost'
predict(object, x, strata, ...)

Arguments

object

output object from the clogitboost function.

x

new matrix or data frame with each column being a covariate.

strata

new vector of group memberships, i.e., items in the same group have the same value.

...

not currently used.

Value

The method predict returns the following list of values:

prob

probability of the outcome equal to 1.

utility

predicted utility.

prediction

0-1 prediction of the outcome variable.

Author(s)

Haolun Shi [email protected]

Guosheng Yin [email protected]

See Also

clogitboost

Examples

data(travel)
train <- 1:504
y <- travel$MODE[train]
x <- travel[train, 3:6]
strata <- travel$Group[train]
fit <- clogitboost(y = y, x = x, strata = strata, iter = 10, rho = 0.05)
predict(fit, x = travel[-train, 3:6], strata = travel$Group[-train])

Summary after fitting a boosting conditional logit model

Description

summary methods for the clogitboost objects.

Usage

## S3 method for class 'clogitboost'
summary(object, ...)

Arguments

object

output object from the clogitboost function.

...

not currently used.

Value

The function clogitboost() returns the following list of values:

call

original function call.

infscore

relative influence score for each covariate.

loglike

sequence of the fitted values of log-likelihood.

Author(s)

Haolun Shi [email protected]

Guosheng Yin [email protected]

See Also

clogitboost

Examples

data(travel)
train <- 1:504
y <- travel$MODE[train]
x <- travel[train, 3:6]
strata <- travel$Group[train]
fit <- clogitboost(y = y, x = x, strata = strata, iter = 10, rho = 0.05)
summary(fit)

Australian travel mode choice data

Description

The dataset is a survey result of 210 individuals' choices of travel mode between Sydney, Melbourne and New South Wales. There are four alternative choices, along with four choice-specific covaraites for each choice.

Usage

data("travel")

Format

A data frame with 840 observations on the following 6 variables.

Group

index of the group membership.

MODE

binary outcome of whether the item is chosen.

TTME

terminal time.

INVC

in-vehicle cost.

INVT

amount of time spent traveling.

GC

genearlized cost of travel.

Source

Greene W (2008). Econometric Analysis, 6th edition. Prentice Hall.