plotPCA: plotPCA

View source: R/plotPCA.R

plotPCAR Documentation

plotPCA

Description

plotPCA returns a 2D plot of optimization data in it's own space using buildPCA. It plots first two PCAs by default.

Usage

plotPCA(x, control = list())

Arguments

x

dataset of parameters to be transformed & plotted

control

control list

Value

It returns a plot image.

Author(s)

Alpar Gür alpar.guer@smail.th-koeln.de

See Also

buildPCA, biplot

Examples

# define objective function
funGauss <- function (x) {
  gauss <- function(par) {
    y <- c(0.0009, 0.0044, 0.0175, 0.0540, 0.1295, 0.2420, 0.3521, 0.3989,
           0.3521, 0.2420, 0.1295, 0.0540, 0.0175, 0.0044, 0.0009)
    m <- 15
    x1 <- par[1]
    x2 <- par[2]
    x3 <- par[3]
    
    fsum <- 0
    for (i in 1:m) {
      ti <- (8 - i) * 0.5
      f <- x1 * exp(-0.5 * x2 * (ti - x3) ^ 2) - y[i]
      fsum <- fsum + f * f
    }
    return(fsum)
  }
  matrix(apply(x, # matrix
               1, # margin (apply over rows)
               gauss),
         , 1) # number of columns
}

# define starting point
x1 <- matrix(c(1,1,1),1,)
funGauss(x1)

# define boundaries
lower = c(-0.001,-0.007,-0.003)
upper = c(0.5,1.0,1.1)

res <- spot(,funGauss, lower=lower, upper=upper, control=list(funEvals=15))

control = list(scale=TRUE) #pca control list, # scale the variables

plotPCA(res$x, control=control) # plot first two PCAs


SPOT documentation built on June 26, 2022, 1:06 a.m.