expit: Success probabilities under the logistic regression model

Description Usage Arguments Value Examples

View source: R/lago_aux_functions.R View source: R/expit_func.R

Description

This function calculates the success probabilities for the logistic regression model for a given vector of covariates and a vector of parameter values. The success probability for a given vector of covariates x and parameter vector beta is calculated as 1/(1 + exp(-beta' X))

Usage

1
expit(beta, x, intercept = TRUE)

Arguments

beta

a vector of true/estimated values of the parameters for a logistic regression model. If intercept = TRUE is specified, the first component should include the value of the intercept term

x

a vector of covariates under the logistic regression model

intercept

a logical argument to specify if the intercept term is included in the model or not. If TRUE, then beta should include the intercept term (default = TRUE)

Value

This function returns the calculated probability of success under the logistic regression model for the given covariate vector and vector of parameters.

Examples

1
2
3
4
5
6
7
8
x = c(2.5, 12.5, 7)
beta.true  = c(log(0.05), log(1.2), log(1.1), log(1.3))
# Default intercept = TRUE
prob <- expit(beta.true, x) # Calculating the probabilities

beta.true  = c(log(1.2), log(1.1), log(1.3))
# intercept = FALSE
prob <- expit(beta.true, x, intercept = FALSE) # Calculating the probabilities

Arhit-Chakrabarti/logisticLAGO documentation built on Dec. 17, 2021, 9:43 a.m.