| Title: | Relevance Vector Machine with Flexible Spike-and-Slab Priors |
|---|---|
| Description: | Fits Relevance Vector Machine (RVM) models for Normal, Epanechnikov, and Bickel prior distributions, and Gaussian or Mexican Hat kernels. |
| Authors: | Alex Sousa [aut, cre], Rafael Oliveira [aut] |
| Maintainer: | Alex Sousa <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-07-22 10:54:33 UTC |
| Source: | https://github.com/cran/rvmprior |
S3 visualization method for objects of class "rvm_prior". Displays the training data, the predicted curve, the true function (if available), and the selected relevance vectors.
## S3 method for class 'rvm_prior' plot(x, f_true = NULL, ...)## S3 method for class 'rvm_prior' plot(x, f_true = NULL, ...)
x |
Object of class "rvm_prior". |
f_true |
Numeric vector or NULL. True function to overlay on the plot. |
... |
Additional arguments (ignored). |
Invisible ggplot object. The plot is printed as a side effect.
dados <- sinc_data(n = 100, SNR = 7) fit <- rvm_prior(dados$x, dados$y, prior = "Epanechnikov", kernel = "gaussian", f_true = dados$f_true) plot(fit)dados <- sinc_data(n = 100, SNR = 7) fit <- rvm_prior(dados$x, dados$y, prior = "Epanechnikov", kernel = "gaussian", f_true = dados$f_true) plot(fit)
Main function of the rvmprior package. Fits a Relevance Vector Machine (RVM) model for regression with support for three types of priors (Normal, Epanechnikov, Bickel) and two kernel types (gaussian, mexican_hat).
rvm_prior( x, y, x_test = NULL, prior = c("Normal", "Epanechnikov", "Bickel"), kernel = c("gaussian", "mexican_hat"), kernel_param = NULL, prior_param = NULL, alpha = 0.95, show_plot = FALSE, f_true = NULL, ... )rvm_prior( x, y, x_test = NULL, prior = c("Normal", "Epanechnikov", "Bickel"), kernel = c("gaussian", "mexican_hat"), kernel_param = NULL, prior_param = NULL, alpha = 0.95, show_plot = FALSE, f_true = NULL, ... )
x |
Numeric vector. Predictor variable (unidimensional). |
y |
Numeric vector. Response variable. Must have the same length as x. |
x_test |
Numeric vector or NULL. Prediction points. If NULL, uses x. |
prior |
Character. Prior for the weights: "Normal", "Epanechnikov", or "Bickel". |
kernel |
Character. Kernel function: "gaussian" or "mexican_hat". |
kernel_param |
Numeric or NULL. Kernel parameter. If NULL, uses an automatic value. |
prior_param |
Numeric or NULL. Prior parameter. If NULL, uses an automatic value. |
alpha |
Numeric between 0 and 1. Spike probability. Default: 0.95. |
show_plot |
Logical. If TRUE, displays the fit plot. Default: FALSE. |
f_true |
Numeric vector or NULL. True function for comparison in the plot. |
... |
Additional arguments passed to rvm_spike_slab (iterations, tol). |
Invisible object of class "rvm_prior" with the fit results.
dados <- sinc_data(n = 100, SNR = 7) fit <- rvm_prior(dados$x, dados$y, prior = "Epanechnikov", kernel = "gaussian") print(fit)dados <- sinc_data(n = 100, SNR = 7) fit <- rvm_prior(dados$x, dados$y, prior = "Epanechnikov", kernel = "gaussian") print(fit)
The sinc function is defined as sinc(x) = sin(x)/x, with limit sinc(0) = 1. Used in nonparametric regression simulations.
sinc_data(n = 100, from = -10, to = 10, SNR = NULL, sd_noise = 0.2, seed = 123)sinc_data(n = 100, from = -10, to = 10, SNR = NULL, sd_noise = 0.2, seed = 123)
n |
Integer. Number of points to generate. Default: 100. |
from |
Numeric. Lower bound of the x domain. Default: -10. |
to |
Numeric. Upper bound of the x domain. Default: 10. |
SNR |
Numeric or NULL. Desired signal-to-noise ratio. If NULL, uses sd_noise. |
sd_noise |
Numeric. Standard deviation of the noise. Used only when SNR is NULL. Default: 0.2. |
seed |
Integer. Seed for reproducibility. Default: 123. |
An object of class "sinc_data" with elements x, y, f_true, sd_noise and SNR.
dados <- sinc_data(n = 100, SNR = 7) print(dados)dados <- sinc_data(n = 100, SNR = 7) print(dados)