arid_countreg: Function to create class object similar to sci-kit learn's...

Description Usage Arguments Value Examples

View source: R/aridanalysis.R

Description

Function to create class object similar to sci-kit learn's object structure for inferential purposes. Given a data frame, the response, and certain specifications return a generalized regression model interface for count data (either using a poisson or a negative binomial distribution) with a fit, predict, and score functions as well as attributes obtained from the statistical analysis.

Usage

1
2
3
4
5
6
7
8
9
arid_countreg(
  X,
  y,
  alpha = 0.05,
  fit_intercept = TRUE,
  verbose = FALSE,
  model = "additive",
  family = "poisson"
)

Arguments

X

(data_frame): the input data frame with the explanatory variables to fit the model.

y

(integer): an integer vector with the response to be fitted (only natural numbers).

alpha

(double): a double vector of length 1 indicating the significance level (default: 0.05)

fit_intercept

(logical): if the model should include the intercept (TRUE or FALSE). (default: FALSE)

verbose

(logical): if results should include a written explanation (TRUE or FALSE). (default: FALSE)

model

(character): type of model to be fitted, either "additive" or "interactive". (default: "additive")

family

(character): distributional family to be used in generalized linear model. (default: "poisson")

Value

a class object with three methods and statistical attributes

Examples

1
2
3
X <- as.data.frame(matrix(rnorm(40 * 3), 40, 3))
y <- sample(c(1:60), 40, replace = TRUE)
arid_countreg(X,y,0.1)

UBC-MDS/aRidanalysis documentation built on March 31, 2021, 5:19 p.m.