GenerateLogit: Generate Logit

Description Usage Arguments Examples

View source: R/GenerateLogit.R

Description

This function generates a new column containing the conditional logit corresponding to a covariate.

Usage

1
2
3
4
5
6
7
8
GenerateLogit(
  DT,
  CrossTable,
  Covariate,
  Suffix = "Logit",
  SelectCol = NULL,
  NewName = NULL
)

Arguments

CrossTable

A cross table with the different levels of the covariate.

Covariate

The name of the covariate.

Data

A data.frame or data.table for which a new column will be generated in.

UseLogit

If the value is TRUE, the join will be based on a column named "Logit". Otherwise, it will look for a column named "Score".

Examples

1
2
3
4
5
6
7
8
Discretize a continuous covariate
mtcars[, mpgCat := cut(mpg, breaks = c(10, 17, 21, 35), include.lowest = T)]

Generate a cross table
mpgTable <- CategoricalTable("am", "mpgCat", mtcars)

Generate the conditional logit
GenerateLogit(mtcars, mpgTable, "mpgCat")

Then-Terence/LXR documentation built on March 12, 2021, 12:04 a.m.