SMED_select: Select points using SMED

Description Usage Arguments Value Examples

Description

SMED_selectC uses C code and should run faster than SMED_select

SMED_selectYC takes in Y values instead of a function. It uses C code and should run faster than SMED_select

SMED_select: R implementation

Usage

1
2
3
4
5
6
SMED_selectC(f, n, X0, Xopt, theta = as.numeric(c()))

SMED_selectYC(n, X0, Xopt, Y0, Yopt, theta = as.numeric(c()))

SMED_select(f, n = 1, X0 = NULL, Xopt = NULL, theta = rep(1, ncol(X0)),
  useC = F)

Arguments

f

Function

n

Number of points to select

X0

Design matrix of already selected points (points in rows)

Xopt

Matrix where each row is a candidate point

theta

Correlation parameters in each dimension for distance scaling

Y0

Y values for X0

Yopt

Y values for Xopt

useC

Should SMED_select call SMED_selectC?

Value

Vector with indices of selected points

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
n = 1
X0 <- matrix(c(.45,.1,.55,.9),ncol=2,byrow=TRUE)
Xopt <- matrix(c(.45,.5,.5,.2),ncol=2,byrow=TRUE)
Y0 <- c(.3,.5)
Yopt <- c(.2,.6)
SMED_selectYC(n, X0, Xopt, Y0, Yopt)

X0 <- matrix(c(.45,.1,.55,.9),ncol=2,byrow=TRUE)
Xopt <- matrix(c(.45,.5,.5,.2),ncol=2,byrow=TRUE)
plot(NULL, xlim=c(0,1), ylim=c(0,1))
points(X0)
text(Xopt, col=2)
SMED_select(function(a) {1}, 1, X0, Xopt)

# Checking if using theta works
X0 <- matrix(c(.1,.1,.5,.5,.9,.9), ncol=2, byrow=TRUE)
Xopt <- matrix(c(.1,.9,.3,.5,.5,.3), ncol=2, byrow=TRUE)
plot(X0,xlim=0:1,ylim=0:1, pch=19)
text(Xopt, col=2, pch=19)
f <- function(x){1} # all have same charge, so only theta matters
# Each dimension equal, pick 1 since it is most spread out
SMED_select(f=f, n=3, X0=X0, Xopt=Xopt)
# y dimension has more variability, pick 3 since it is furthest from X0 in y direction
SMED_select(f=f, n=3, X0=X0, Xopt=Xopt, theta=c(1,1e3))
# x dimension has more variability, pick 2 since it is furthest from X0 in x direction
SMED_select(f=f, n=3, X0=X0, Xopt=Xopt, theta=c(1,1e-3))

CollinErickson/SMED-Code documentation built on May 6, 2019, 12:27 p.m.