Skip to content

Commit 25a8e32

Browse files
Change default fit based on n points
1 parent 7acc9b7 commit 25a8e32

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

R/cf_data.R

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,21 @@ cf_data <- function(x, y=NULL, z=NULL,
5050
y <- x[,2]
5151
x <- x[,1]
5252
}
53+
# Check fit name given
54+
if (fit == "") {
55+
if (length(x) > 200) {
56+
fit <- "locfit"
57+
message("Fitting with locfit since n > 200")
58+
} else {
59+
fit <- "lagp"
60+
message("Fitting with laGP since n <= 200")
61+
}
62+
}
5363
# Fits a Gaussian process model that interpolates perfectly, i.e., no smoothing
5464
if (fit == "mlegp") {
5565
co <- capture.output(mod <- mlegp::mlegp(X=data.frame(x,y),Z=z,verbose=0))
5666
pred.func <- function(xx) {mlegp::predict.gp(mod,xx)}
57-
} else if (fit %in% c("lagp", "")) {
67+
} else if (fit %in% c("lagp")) {
5868
X <- data.frame(x, y)
5969
da <- laGP::darg(list(mle=TRUE), X=X)
6070
ga <- laGP::garg(list(mle=TRUE), y=z)

0 commit comments

Comments
 (0)