# Compute the asymmetric piecewise quadratic scoring function (expectile scoring
# function).
df <- data.frame(
y = rep(x = 0, times = 6),
x = c(2, 2, -2, -2, 0, 0),
p = rep(x = c(0.05, 0.95), times = 3)
)
df$expectile_penalty <- expectile_sf(x = df$x, y = df$y, p = df$p)
print(df)
# The asymmetric piecewise quadratic scoring function (expectile scoring
# function) at level p = 0.5 is half the squared error scoring function.
df <- data.frame(
y = rep(x = 0, times = 3),
x = c(-2, 0, 2),
p = rep(x = c(0.5), times = 3)
)
df$expectile_penalty <- expectile_sf(x = df$x, y = df$y, p = df$p)
df$squared_error <- serr_sf(x = df$x, y = df$y)
print(df)
Run the code above in your browser using DataLab