pp: Creates the projection pursuit function.

Description Usage Arguments Details Value Author(s) Examples

View source: R/PP_Index_sdistribution_3f_1.R

Description

These functions encapsulate everything, that is, the data, the benchmark and the index parameters, needed to compute the projection index.

Usage

1
pp(r = 0.8, n, data, oth, k)

Arguments

r

The radius multiplier. Values between 0.5 and 3 seem to work well.

n

Number of Monte-Carlo Evaluations to approximate the integral. Values as low as 25 can be used.

data

The data for which structure needs to be found.

oth

The benchmark dataset.

k

The target dimension.

Details

pp is for projection pursuit.

Value

The actual index function, which takes a single matrix argument, and returns the index value for that projection.

Author(s)

Mohit Dayal

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
##Exploring structure in the RANDU data
##Or using the MINSTD generator
randu <- as.matrix(randu)

randtoolbox::setSeed(570)
w <- randtoolbox::congruRand(1200)
dim(w) <- c(3, 400)
w <- t(w)

m <- 'geodesic'
a <- 0.50

ranif1 <- pp(r=1, n=50, data=randu, oth=w, k=2)

set.seed(50)
F1 <- basis_random(3)
o1 <- optim(par=F1, fn=ranif1, gr=basis_nearby(), method='SANN',
            control=list(fnscale=-1, maxit=100, trace=1))
plot(randu %*% o1$par)

##How accurate are the values?
ranif1hi <- pp(r=1, n=500, data=randu, oth=w, k=2)
ranif1hi(o1$par)

Example output

Loading required package: trust
Warning message:
In crossprod(x[, j], x[, i]) * x[, i] :
  Recycling array of length 1 in array-vector arithmetic is deprecated.
  Use c() or as.vector() instead.

sann objective function values
initial       value -0.008560
final         value -0.034088
sann stopped after 99 iterations
There were 50 or more warnings (use warnings() to see the first 50)
[1] 0.03351325

cepp documentation built on May 2, 2019, 3:44 p.m.