Learn R Programming

WpProj (version 0.2.1)

plot,WPR2-method: Plot Function for \(W_p R^2\) Objects

Description

Plot Function for \(W_p R^2\) Objects

Usage

# S4 method for WPR2
plot(
  x,
  xlim = NULL,
  ylim = NULL,
  linesize = 0.5,
  pointsize = 1.5,
  facet.group = NULL,
  ...
)

Value

a ggplot2::ggplot() object

Arguments

x

A \(W_p R^2\) object

xlim

x-axis limits

ylim

y-axis limits

linesize

Linesize for geom_line

pointsize

Point size for geom_point

facet.group

Group to do facet_grid by

...

Currently not used

Examples

Run this code
n <- 128
p <- 10
s <- 99
x <- matrix( stats::rnorm( p * n ), nrow = n, ncol = p )
beta <- (1:10)/10
y <- x %*% beta + stats::rnorm(n)
post_beta <- matrix(beta, nrow=p, ncol=s) + stats::rnorm(p*s, 0, 0.1)
post_mu <- x %*% post_beta

fit <-  WpProj(X=x, eta=post_mu, power = 2.0,
               options = list(penalty = "lasso")
)
obj <- WPR2(predictions = post_mu, projected_model = fit)
p <- plot(obj)

Run the code above in your browser using DataLab