runOpt: Optimal pixel selection for HCAS

Description Usage Arguments Value See Also Examples

View source: R/optPix_code.R

Description

This function is used to obtain optimal sample size and position of geo-spatial locations/pixels.

Usage

1
2
3
4
runOpt(design.matrix, coords, response=NULL, initSampleSize = 10,
       increment.factor = 5, threshold = 0.05, optType = "exact",
       model = "univariate", weight.response = NULL, store.para = TRUE,
       seed=1234)

Arguments

design.matrix

n x p in matrix/data format.

coords

n x 2 coordinates in matrix/data format.

response

n x q matrix, q = 1 if univariate.

initSampleSize

Number of initial samples.

increment.factor

Number of increments in each iteration.

threshold

Threshold value for convergence of the rate of change.

optType

Can take 2 arguments: (i) "exact" for exact algorithm and (ii) "montecarlo" for montecarlo algorithm.

model

Can take "univariate" or "multivariate".

weight.response

Optional for multivariate model prediction, if null then use equal weights for multivariate response.

store.para

Store all validation parameters related to the algorithm. Default value is TRUE.

seed

User input of seed number. Default 1234.

Value

model

Model used in the algorithm.

optType

Algorithm type.

coords

Pixel coordinates.

optCoords

Optimal pixel coordinates.

optID

Optimal ID.

new.design.matrix

Design matrix based on the optimal samples.

new.response

Response based on the optimal samples. NULL if no response is used as input.

comp.time

Returns the computation time.

See Also

plot.pa.

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
27
28
29
## Not run: 
######################################################
## 
## simulate design matrix and coordinates
n <- 100
p <- 5
x <- c()
for(i in 1:p){
 set.seed(1234+i)
 x <- cbind(x,rnorm(n,10,1))
}
head(x)
coords <- expand.grid(x = seq(0,1,length.out=10), y = seq(0,1,length.out=10))
plot(coords,pch="*")
##
## univariate model 
beta <- c(0.2,0.5,0.4,0.3,0.6)
response <- x
out <- runOpt(design.matrix=x, coords=coords, response=c(response),
              increment.factor = 1, threshold = 0.01, initSampleSize = 5,
              optType = "exact", model = "univariate", weight.response = NULL,
              seed=1234)
out
plot(out)
##
##
######################################################

## End(Not run)

ksbakar/optHCAS documentation built on Dec. 21, 2021, 8:39 a.m.