logs.numeric | R Documentation |
Calculate the logarithmic score (LogS) given observations and parameters of a family of distributions.
## S3 method for class 'numeric'
logs(y, family, ...)
y |
Vector of realized values. |
family |
String which specifies the parametric family; current options:
|
... |
Vectors of parameter values; expected input depends on the chosen
|
The parameters supplied to each of the functions are numeric vectors:
Distributions defined on the real line:
"laplace"
or "lapl"
:
location
(real-valued location parameter),
scale
(positive scale parameter);
see logs_lapl
"logistic"
or "logis"
:
location
(real-valued location parameter),
scale
(positive scale parameter);
see logs_logis
"normal"
or "norm"
:
mean
, sd
(mean and standard deviation);
see logs_norm
"normal-mixture"
or "mixture-normal"
or "mixnorm"
:
m
(mean parameters),
s
(standard deviations),
w
(weights);
see logs_mixnorm
;
note: matrix-input for parameters
"t"
:
df
(degrees of freedom),
location
(real-valued location parameter),
scale
(positive scale parameter);
see logs_t
"two-piece-exponential"
or "2pexp"
:
location
(real-valued location parameter),
scale1
, scale2
(positive scale parameters);
see logs_2pexp
"two-piece-normal"
or "2pnorm"
:
location
(real-valued location parameter),
scale1
, scale2
(positive scale parameters);
see logs_2pnorm
Distributions for non-negative random variables:
"exponential"
or "exp"
:
rate
(positive rate parameter);
see logs_exp
"gamma"
:
shape
(positive shape parameter),
rate
(positive rate parameter),
scale
(alternative to rate
);
see logs_gamma
"log-laplace"
or "llapl"
:
locationlog
(real-valued location parameter),
scalelog
(positive scale parameter);
see logs_llapl
"log-logistic"
or "llogis"
:
locationlog
(real-valued location parameter),
scalelog
(positive scale parameter);
see logs_llogis
"log-normal"
or "lnorm"
:
locationlog
(real-valued location parameter),
scalelog
(positive scale parameter);
see logs_lnorm
Distributions with flexible support and/or point masses:
"beta"
:
shape1
, shape2
(positive shape parameters),
lower
, upper
(lower and upper limits);
see logs_beta
"uniform"
or "unif"
:
min
, max
(lower and upper limits);
see logs_unif
"exp2"
:
location
(real-valued location parameter),
scale
(positive scale parameter);
see logs_exp2
"gev"
:
location
(real-valued location parameter),
scale
(positive scale parameter),
shape
(real-valued shape parameter);
see logs_gev
"gpd"
:
location
(real-valued location parameter),
scale
(positive scale parameter),
shape
(real-valued shape parameter);
see logs_gpd
"tlogis"
:
location
(location parameter),
scale
(scale parameter),
lower
, upper
(lower and upper limits);
see logs_tlogis
"tnorm"
:
location
(location parameter),
scale
(scale parameter),
lower
, upper
(lower and upper limits);
see logs_tnorm
"tt"
:
df
(degrees of freedom),
location
(location parameter),
scale
(scale parameter),
lower
, upper
(lower and upper limits);
see logs_tt
Distributions of discrete variables:
"binom"
:
size
(number of trials (zero or more)),
prob
(probability of success on each trial);
see crps_binom
"hyper"
:
m
(the number of white balls in the urn),
n
(the number of black balls in the urn),
k
(the number of balls drawn from the urn);
see crps_hyper
"negative-binomial"
or "nbinom"
:
size
(positive dispersion parameter),
prob
(success probability),
mu
(mean, alternative to prob
);
see logs_nbinom
"poisson"
or "pois"
:
lambda
(positive mean);
see logs_pois
All numerical arguments should be of the same length. An exception are scalars of length 1, which will be recycled.
Vector of score values. A lower score indicates a better forecast.
Alexander Jordan, Fabian Krueger, Sebastian Lerch
crps.numeric
logs(y = 1, family = "normal", mean = 0, sd = 2)
logs(y = rnorm(20), family = "normal", mean = 1:20, sd = sqrt(1:20))
## Arguments can have different lengths:
logs(y = rnorm(20), family = "normal", mean = 0, sd = 2)
logs(y = 1, family = "normal", mean = 1:20, sd = sqrt(1:20))
## Mixture of normal distributions requires matrix input for parameters:
mval <- matrix(rnorm(20*50), nrow = 20)
sdval <- matrix(runif(20*50, min = 0, max = 2), nrow = 20)
weights <- matrix(rep(1/50, 20*50), nrow = 20)
logs(y = rnorm(20), family = "mixnorm", m = mval, s = sdval, w = weights)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.