Pval.dist: p-value of a given similarity value

Description Usage Arguments Value Author(s) See Also Examples

View source: R/StabilityFunctions.R

Description

This function calculates the p-value of a given similarity value, i.e. the probability for obtaining the same or a smaller value than the given one in a vector of random similarity values. The p-value is used to determine whether the given similarity value is significant.

Usage

1
Pval.dist(dist.val, random.vals)

Arguments

dist.val

A numeric value quanifying the similarity for which a p-value should be calculated.

random.vals

A numeric vector of random similarities used for calculating the p-value.

Value

It returns a numeric value between 0 and 1 that specifies the p-value of the given dist.val.

Author(s)

Jasmina Bogojeska

See Also

L1.dist, kullback.leibler, comp.models, stability.sim

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## The function is currently defined as
function(dist.val, random.vals) {
  return((sum(random.vals <= dist.val) + 1) /(length(random.vals) + 1))
  }

## Define the similarity value and a vector of random similarities
sim.val <- 0.2
rand.vals <- c(0.1, 0.24, 0.28, 0.35, 0.15, 0.5, 0.14, 0.6, 0.8, 0.3)

## Calculate the p-value of sim.val using the vector of random
## similarities
Pval.dist(dist.val = sim.val, random.vals = rand.vals)
 

Rtreemix documentation built on Nov. 8, 2020, 5:57 p.m.