prob_logit: Get probabilities from logistic regression coefficients.

View source: R/prob_logit.R

prob_logitR Documentation

Get probabilities from logistic regression coefficients.

Description

After a logistic model fit a logit function with the coefficients of the regression to get the probabilities given a distance vector. Usually the distance vector is used to plot the logistic model as a curve from 0 to the maximum value of a distribution matrix used to perform de logistic regression model.

Usage

prob_logit(coef, dist)

Arguments

coef

A vector of two elements of coefficients (Intercept and slope) in a logistic regression.#'

dist

A vector of distance to perform de regression

Value

A vector of probabilities given the vector of regression

Examples

phy_dist <- ape::cophenetic.phylo(host_tree)
phy_dist <- log10(phy_dist + 1)
incidence_matrix <-  get_incidence_matrix(beetleTreeInteractions)
incidence_matrix <- incidence_matrix[ ,colnames(phy_dist)]
coefficients <- log_reg_boostrap(incidence_matrix, phy_dist, 10)
coefficientsValues <- c(coefficients[["intercept"]], coefficients[["slope"]] )
distVector <- seq(0, max(phy_dist), 1)
prob_logit(coefficientsValues, distVector)

alrobles/geotax documentation built on July 27, 2023, 4:37 a.m.