Description Usage Arguments Value See Also Examples
View source: R/crps_vonmises.R
Continuous Ranked Probability Score (CRPS) for a circular response following the von Mises distribution.
1 | crps_vonmises(y, mu, kappa, sum = FALSE)
|
y |
numeric. Circular response. |
mu |
numeric. Location parameter of the von Mises distribution. |
kappa |
numeric. Concentration parameter of the von Mises distribution. |
sum |
logical. Should the sum of the CRPS-values over all response values be returned. |
For sum=TRUE
the sum of the CRPS-values of all response values is returned. Otherwise
a vector of the same length as y
with the observation-wise CRPS-values is returned.
1 2 3 4 5 6 7 8 9 10 11 12 | set.seed(123)
sdat <- circtree_simulate(n = 100)
m1.circtree <- circtree(y ~ x1 + x2, data = sdat)
foo <- function(x, deg = FALSE){
if(deg) x <- x * pi / 180
tmp <- x
tmp <- ifelse(tmp > pi, -(pi - (tmp - pi)), tmp)
if(deg) tmp <- tmp * 180 / pi
tmp
}
testcrps <- crps_vonmises(foo(sdat$y), mu = predict(m1.circtree)$mu, predict(m1.circtree)$kappa)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.