crps_vonmises: Circular CRPS

Description Usage Arguments Value See Also Examples

View source: R/crps_vonmises.R

Description

Continuous Ranked Probability Score (CRPS) for a circular response following the von Mises distribution.

Usage

1

Arguments

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.

Value

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.

See Also

circtree

Examples

 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) 

circtree documentation built on Aug. 14, 2019, 3 p.m.