as.murphydiag: Coerce to a Murphy diagram

Description Usage Arguments Details Value

View source: R/coercion.R

Description

generic function with a default method, and additional methods for classes lm, randomForest, rq (from package quantreg).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
as.murphydiag(x, ...)

## Default S3 method:
as.murphydiag(x, y = NULL, type = NULL,
  level = NULL, m = NULL, xnames = NULL, ...)

## S3 method for class 'data.frame'
as.murphydiag(x, y = NULL, type = NULL,
  level = NULL, m = NULL, xnames = NULL, ...)

## S3 method for class 'murphydiag'
as.murphydiag(x, y = NULL, type = NULL,
  level = NULL, m = NULL, tol = sqrt(.Machine$double.eps), ...)

## S3 method for class 'lm'
as.murphydiag(x, y = NULL, type = NULL, level = NULL,
  m = NULL, xnames = NULL, newdata = NULL, ...)

## S3 method for class 'rq'
as.murphydiag(x, y = NULL, type = NULL, level = NULL,
  m = NULL, xnames = NULL, newdata = NULL, ...)

## S3 method for class 'randomForest'
as.murphydiag(x, y = NULL, type = NULL,
  level = NULL, m = NULL, xnames = NULL, newdata = NULL, ...)

is.murphydiag(x)

simplifyFunctional(m, tol = sqrt(.Machine$double.eps))

generalizeFunctional(m)

Arguments

x

any R object.

y

a numeric vector of response values to be predicted.

type

a string specifying the type of forecast; one of "prob", "mean", "expectile", "median", "quantile".

level

a single numeric value for the level of the "quantile" or "expectile" functional.

m

an object inheriting from the class 'murphydiag'; alternative to y, type, level.

xnames

a character vector of prediction names.

tol

accuracy when comparing y and level in 'murphydiag' objects.

newdata

an optional data frame used as environment in which to evaluate predict methods of model objects.

Details

In the default version, the user specifies all relevant information (forecasts, realizations, information on the type of forecast) manually. Furthermore, murphydiag accepts fitted model objects from a few other packages:

as.murphydiag.randomForest converts the classification problem to a binary problem with the first class treated as 1 and all other classes as 0

Value

as.murphydiag returns a 'murphydiag' object.

is.murphydiag returns TRUE if its argument is a Murphy diagram, that is, has "murphydiag" among its classes, and FALSE otherwise.

simplifyFunctional coerces type and level of a 'murphydiag' object from "quantile" to "median", or "expectile" to "mean", if possible. That is, when level is close enough to 0.5.

generalizeFunctional coerces type of a 'murphydiag' object from "prob" or "mean" to "expectile" with level at 0.5, or "median" to "quantile" with level at 0.5.


aijordan/murphydiagram2 documentation built on Jan. 1, 2020, 3:08 p.m.