Learn R Programming

gettingtothebottom (version 3.2)

plot_nnm_truth: MM Algorithm - Plotting the True Signal

Description

plot_nnm_truth Function for plotting the true mixture signal

Usage

plot_nnm_truth(X, b, nnm)

Arguments

X
Nonnegative design matrix
b
Nonnegative initial regression vector
nnm
NNM object from generate_nnm function

Examples

Run this code
# Setup mixture example
n <- 1e3
p <- 10
nnm <- generate_nnm(n,p)

set.seed(12345)
X <- nnm$X
b <- double(p)
nComponents <- 3
k <- sample(1:p,nComponents,replace=FALSE)
b[k] <- matrix(runif(nComponents),ncol=1)
y <- X%*%b + 0.25*matrix(abs(rnorm(n)),n,1)

# Plot the truth
plot_nnm_truth(X,b,nnm)

Run the code above in your browser using DataLab