ridgePlot | R Documentation |
This function will plot the distribution of predictions for a range of active coefficients
ridgePlot(
fit,
index = 1,
minCoef = 1,
maxCoef = 10,
scale = 1,
alpha = 0.5,
full = NULL,
transform = function(x) {
x
},
xlab = "Predictions",
bandwidth = NULL
)
fit |
A |
index |
The observation number to select. Can be a vector |
minCoef |
The minimum number of coefficients to use |
maxCoef |
The maximum number of coefficients to use |
scale |
How the densities should be scale |
alpha |
Alpha term from ggplot2 object |
full |
"True" prediction to compare to |
transform |
transform for predictions |
xlab |
x-axis label |
bandwidth |
Bandwidth for kernel |
a ggplot2::ggplot()
plot
if(rlang::is_installed("stats")) {
n <- 128
p <- 10
s <- 99
x <- matrix(stats::rnorm(n*p), nrow = n, ncol = p )
beta <- (1:10)/10
y <- x %*% beta + stats::rnorm(n)
post_beta <- matrix(beta, nrow=p, ncol=s) + matrix(stats::rnorm(p*s, 0, 0.1), p, s)
post_mu <- x %*% post_beta
fit <- WpProj(X=x, eta=post_mu,
power = 2
)
ridgePlot(fit)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.