Skip to content

Instantly share code, notes, and snippets.

@halflearned
Last active July 16, 2018 00:00
Show Gist options
  • Save halflearned/eb54423187ee3d2d9e15a0230dd4688e to your computer and use it in GitHub Desktop.
Save halflearned/eb54423187ee3d2d9e15a0230dd4688e to your computer and use it in GitHub Desktop.
'argument is not a matrix' and related bugs
# PART II
library(DiceKriging)
n <- 100
k <- 3
# Design (fit.draws in tune_*_forest)
design <- matrix(runif(n*k), n, k)
# If both 'response' and 'noise.var' are constants,
# we get the 'argument is not a matrix' error
tryCatch(
DiceKriging::km(design = design,
response = rep(1, n),
noise.var = rep(1, n)),
error=function(e) print(e)
)
# If 'response' is constant
# but 'noise.var' is not,
# then we get a 'leading minor' error
tryCatch(
DiceKriging::km(design = design,
response = rep(1, n),
noise.var = rnorm(n)),
error=function(e) print(e)
)
# Weirdly:
# If 'response' is not constant
# then we get no error even if
# 'noise.var' is zero (!)
DiceKriging::km(design = design,
response = debiased.errors,
noise.var = variance.guess)
cat("Look, ma, no error!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment