prediction_score {aphylo}R Documentation

Calculate prediction score (quality of prediction)

Description

Calculate prediction score (quality of prediction)

Usage

prediction_score(x, expected, alpha0 = NULL, alpha1 = NULL, W = NULL, ...)

## Default S3 method:
prediction_score(x, expected, alpha0 = NULL, alpha1 = NULL, W = NULL, ...)

## S3 method for class 'aphylo_estimates'
prediction_score(
  x,
  expected = NULL,
  alpha0 = NULL,
  alpha1 = NULL,
  W = NULL,
  loo = TRUE,
  ...
)

## S3 method for class 'aphylo_prediction_score'
print(x, ...)

Arguments

x

An object of class aphylo_estimates or a numeric matrix.

expected

Integer vector of length n. Expected values (either 0 or 1).

alpha0, alpha1

Probability of observing a zero an a one, respectively.

W

A square matrix. Must have as many rows as genes in expected.

...

Further arguments passed to predict.aphylo_estimates

loo

Logical scalar. When loo = TRUE, predictions are preformed similar to what a leave-one-out cross-validation scheme would be done (see predict.aphylo_estimates).

Details

In the case of prediction_score, ... are passed to predict.aphylo_estimates.

In the case of the method for aphylo estimates, the function takes as a reference using alpha equal to the proportion of observed tip annotations that are equal to 1, this is:

mean(x$dat$tip.annotation[x$dat$tip.annotation != 9L], na.rm = TRUE)

Value

A list of class aphylo_prediction_score:

Examples

# Example with prediction_score ---------------------------------------------
set.seed(11552)
ap  <- raphylo(
  50, P = 1,
  Pi   = 0,
  mu_d = c(.8,.2),
  mu_s = c(0.1,0.1),
  psi  = c(0,0)
  )
ans <- aphylo_mcmc(
  ap ~ mu_d + mu_s + Pi,
  control = list(nsteps=2e3, thin=20, burnin = 500),
  priors = bprior(c(9, 1, 1, 1, 5), c(1, 9, 9, 9, 5))
  )
                   
(pr <- prediction_score(ans, loo = TRUE))
plot(pr)

[Package aphylo version 0.3-3 Index]