-
-
Notifications
You must be signed in to change notification settings - Fork 9
Plotting
Simone Vazzoler edited this page Apr 24, 2017
·
1 revision
To plot a generic matrix, use the function
plotMatrix(M, colors="dark")
where M
is the matrix you want to plot and colors="dark"
is the color-scale
that is used (colors
can be "light"
or "dark"
).
Let us generate and plot a random 10x10 matrix
M <- matrix(rnorm(100), ncol=10, nrow=10)
plotMatrix(M)
To plot the same matrix with a light color scale use
plotMatrix(M, colors="light")
It is possible to plot directly a VAR object (fitted or simulated) using the function
plotVAR(..., colors = "dark")
Now we simulate a VAR(2) process and then we estimate it using "ENET"
and "SCAD"
:
sim <- simulateVAR(N = 15, p = 2, sparsity = 0.15, covariance = "block2")
fitENET <- fitVAR(sim$series, p = 2, foldsIDs = TRUE)
fitSCAD <- fitVAR(sim$series, p = 2, penalty = "SCAD", foldsIDs = TRUE)
and then we plot all the models
plotVAR(sim, fitENET, fitSCAD, colors = "light")
sparsevar
package wiki