Title: | Likelihood Criterion (LIC) Analysis for Laplace Regression Model |
---|---|
Description: | Performs likelihood criterion analysis using the Laplace regression model to determine its optimal subset of variables. The methodology is based on Guo et al. (2023), LIC criterion for optimal subset selection in distributed interval estimation <doi:10.1080/02331888.2020.1823979>. |
Authors: | Guangbao Guo [aut, cre], Yaxuan Wang [aut] |
Maintainer: | Guangbao Guo <[email protected]> |
License: | MIT + file LICENSE |
Version: | 3.0.0 |
Built: | 2024-11-28 13:54:58 UTC |
Source: | CRAN |
This function processes the data generated for the LLIC analysis, including filtering, mutation, and selection of specific columns.
data_pc(data)
data_pc(data)
data |
A data frame containing the raw data generated for the LLIC analysis. |
A data frame with the following columns:
X1 |
The filtered values of the original 'X1' column, keeping only rows where 'X1 <= 2'. |
X2 |
The original 'X2' column. |
X1_squared |
A new column containing the square of the 'X1' values. |
set.seed(12) library(dplyr) library(VGAM) raw_data <- data.frame( X1 = sample(1:3, 1200, replace = TRUE), X2 = sample(1:3, 1200, replace = TRUE), X3 = sample(1:3, 1200, replace = TRUE), X4 = sample(1:3, 1200, replace = TRUE), X5 = sample(1:3, 1200, replace = TRUE), Y = rlaplace(1200, 0, 1) ) processed_data <- data_pc(raw_data)
set.seed(12) library(dplyr) library(VGAM) raw_data <- data.frame( X1 = sample(1:3, 1200, replace = TRUE), X2 = sample(1:3, 1200, replace = TRUE), X3 = sample(1:3, 1200, replace = TRUE), X4 = sample(1:3, 1200, replace = TRUE), X5 = sample(1:3, 1200, replace = TRUE), Y = rlaplace(1200, 0, 1) ) processed_data <- data_pc(raw_data)
This function carries out an Laplace LIC analysis utilizing the Lre model.
LLIC(X, y, alpha, K)
LLIC(X, y, alpha, K)
X |
Design matrix |
y |
Random response vector of observed values |
alpha |
Significance level |
K |
Number of subsets |
A list containing the following components:
MUopt |
A vector of the means of the predictor variables in the optimal subset. |
Bopt |
A vector of the estimated regression coefficients from the final model fitted to the optimal subset. |
MAEMUopt |
The Mean Absolute Error (MAE) for the optimal subset. |
MSEMUopt |
The Mean Squared Error (MSE) for the optimal subset. |
opt |
Currently NULL, a placeholder for potential future use. |
Yopt |
A vector of the predicted values from the final model fitted to the optimal subset. |
set.seed(12) library(VGAM) X <- matrix(data = sample(1:3, 1200 * 5, replace = TRUE), nrow = 1200, ncol = 5) b <- sample(1:3, 5, replace = TRUE) e <- rlaplace(1200, 0, 1) Y <- X %*% b + e alpha <- 0.05 K <- 10 result <- LLIC(X, Y, alpha, K) MUopt <- result$MUopt Bopt <- result$Bopt MAEMUopt <- result$MAEMUopt MSEMUopt <- result$MSEMUopt opt <- result$opt Yopt <- result$Yopt
set.seed(12) library(VGAM) X <- matrix(data = sample(1:3, 1200 * 5, replace = TRUE), nrow = 1200, ncol = 5) b <- sample(1:3, 5, replace = TRUE) e <- rlaplace(1200, 0, 1) Y <- X %*% b + e alpha <- 0.05 K <- 10 result <- LLIC(X, Y, alpha, K) MUopt <- result$MUopt Bopt <- result$Bopt MAEMUopt <- result$MAEMUopt MSEMUopt <- result$MSEMUopt opt <- result$opt Yopt <- result$Yopt
This function visualizes the results of the LLIC analysis, including a comparison of actual and predicted values, and a bar chart of model coefficients.
plot_LLIC(X, Y, result)
plot_LLIC(X, Y, result)
X |
Design matrix used in the LLIC analysis. |
Y |
Random response vector of observed values used in the LLIC analysis. |
result |
A list containing the results of the Laplace LIC analysis from the LLIC function. |
A list containing two 'ggplot' objects:
Actual_vs_Pred |
A scatter plot comparing the actual vs predicted values. |
Coef |
A bar chart displaying the model's coefficients. |
set.seed(12) library(VGAM) library(rlang) library(dplyr) library(ggplot2) X <- matrix(data = sample(1:3, 1200 * 5, replace = TRUE), nrow = 1200, ncol = 5) b <- sample(1:3, 5, replace = TRUE) e <- rlaplace(1200, 0, 1) Y <- X %*% b + e alpha <- 0.05 K <- 10 result <- LLIC(X, Y, alpha, K) plot_LLIC(X, Y, result) plots <- plot_LLIC(X, Y, result) print(plots$Actual_vs_Pred) print(plots$Coef)
set.seed(12) library(VGAM) library(rlang) library(dplyr) library(ggplot2) X <- matrix(data = sample(1:3, 1200 * 5, replace = TRUE), nrow = 1200, ncol = 5) b <- sample(1:3, 5, replace = TRUE) e <- rlaplace(1200, 0, 1) Y <- X %*% b + e alpha <- 0.05 K <- 10 result <- LLIC(X, Y, alpha, K) plot_LLIC(X, Y, result) plots <- plot_LLIC(X, Y, result) print(plots$Actual_vs_Pred) print(plots$Coef)