find_reps: Data preprocessing

View source: R/hetGP.R

find_repsR Documentation

Data preprocessing

Description

Prepare data for use with mleHetGP, in particular to find replicated observations

Usage

find_reps(
  X,
  Z,
  return.Zlist = TRUE,
  rescale = FALSE,
  normalize = FALSE,
  inputBounds = NULL
)

Arguments

X

matrix of design locations, one point per row

Z

vector of observations at X

return.Zlist

to return Zlist, see below

rescale

if TRUE, the inputs are rescaled to the unit hypercube

normalize

if TRUE, the outputs are centered and normalized

inputBounds

optional matrix of known boundaries in original input space, of size 2 times ncol(X). If not provided, and rescale == TRUE, it is estimated from the data.

Details

Replicates are searched based on character representation, using unique.

Value

A list with the following elements that can be passed to the main fitting functions, e.g., mleHetGP and mleHomGP

  • X0 matrix with unique designs locations, one point per row,

  • Z0 vector of averaged observations at X0,

  • mult number of replicates at X0,

  • Z vector with all observations, sorted according to X0,

  • Zlist optional list, each element corresponds to observations at a design in X0,

  • inputBounds optional matrix, to rescale back to the original input space,

  • outputStats optional vector, with mean and variance of the original outputs.

Examples

##------------------------------------------------------------
## Find replicates on the motorcycle data
##------------------------------------------------------------
## motorcycle data
library(MASS)
X <- matrix(mcycle$times, ncol = 1)
Z <- mcycle$accel

data_m <- find_reps(X, Z)

# Initial data
plot(X, Z, ylim = c(-160, 90), ylab = 'acceleration', xlab = "time")
# Display mean values
points(data_m$X0, data_m$Z0, pch = 20)

hetGP documentation built on Sept. 11, 2024, 6:56 p.m.