Learn R Programming

GPpenalty (version 1.0.1)

score: score

Description

Calculates a score value. Higher score values indicate better fits.

Usage

score(y, mu, sigma, md = FALSE)

Value

a numerical value

Arguments

y

response variable vector

mu

predicted mean vector

sigma

predicted covariance matrix

md

logical indicating whether to return to a Mahalanobis distance value (md = TRUE) and score value or only a score value (md = FALSE)

Examples

Run this code

### test function ###
f_x <- function(x) {
return(sin(2*pi*x) + x^2)
}

### training data ###
n <- 8
x <- runif(n, 0, 1)
y <- f_x(x)

### testing data ###
n.test <- 100
x.test <- runif(n.test, 0, 1)
y.test <- f_x(x.test)

### get parameter estimates ###
out <- mle_gp(y, x)

### prediction ###
pred <- predict_gp(out, x.test)

### get score value ###
score_value <- score(y.test, pred$mup, pred$Sigmap)

Run the code above in your browser using DataLab