Learn R Programming

mvdalab (version 1.7)

plot.cp: Plotting Function for Score Contributions.

Description

This function generates a plot an object of class score.contribution

Usage

# S3 method for cp
plot(x, ncomp = "Overall", ...)

Value

The output of plot is a graph of score contributions for the specified observation(s).

Arguments

x

score.contribution object

ncomp

the number of components to include the graph output.

...

additional arguments. Currently ignored.

Author

Nelson Lee Afanador (nelson.afanador@mvdalab.com)

Details

A graph of the score contributions for ScoreContrib objects.

Examples

Run this code
data(Penta)
mod1 <- plsFit(log.RAI ~., scale = TRUE, data = Penta[, -1],
               ncomp = 2, method = "bidiagpls", validation = "loo")
Score.Contributions1 <- ScoreContrib(mod1, obs1 = 1, obs2 = 3)
plot(Score.Contributions1, ncomp = 1)

if (FALSE) {
data(Penta)
## Number of bootstraps set to 300 to demonstrate flexibility
## Use a minimum of 1000 (default) for results that support bootstraping
mod2 <- plsFit(log.RAI ~., scale = TRUE, data = Penta[, -1],
               ncomp = 2, validation = "oob", boots = 300)
Score.Contributions2 <- ScoreContrib(mod2, obs1 = 1, obs2 = 3)
plot(Score.Contributions2, ncomp = 1)
}

#PCA Model
pc1 <- pcaFit(Penta[, -1], ncomp = 3)
Score.Contributions1 <- ScoreContrib(mod1, obs1 = 1, obs2 = 3)
plot(Score.Contributions1, ncomp = 1)

Run the code above in your browser using DataLab