estimateCoefficientsIndividual | R Documentation |
This function estimates coefficients for a logistic regression model ('logit') on a subset of features specified by 'ind'. It evaluates the individual model’s performance by calculating the Akaike Information Criterion (AIC) and returns the coefficients.
estimateCoefficientsIndividual(X, y, ind, type = "logit")
X |
A matrix or data frame representing the features of the dataset. |
y |
A vector representing the binary target variable for the dataset. |
ind |
A vector of feature indices specifying the subset of features to include in the model. |
type |
A character string specifying the type of model to fit. Currently, only '"logit"' (logistic regression) is supported. |
The function fits a logistic regression model using the features specified in 'ind'. If 'ind' contains a single feature, the function formats 'X' accordingly. It then calculates the coefficients for each feature and the AIC of the model, providing insights into model performance.
**Note**: Currently, only '"logit"' models are supported. Other types will result in an error message.
A list containing: - 'coefs': A named vector of estimated coefficients for each feature in 'ind'. - 'aic': The AIC value for the fitted logistic model, indicating model fit. - 'glm': The fitted 'glm' object.
## Not run:
X <- matrix(rnorm(100), nrow = 10)
y <- sample(0:1, 10, replace = TRUE)
ind <- c(1, 2, 3) # Example subset of feature indices
result <- estimateCoefficientsIndividual(X, y, ind, type = "logit")
print(result$coefs) # Estimated coefficients
print(result$aic) # AIC of the model
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.