Learn R Programming

Rtreemix (version 1.34.0)

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

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

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.

See Also

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

Examples

Run this code
## 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)
 

Run the code above in your browser using DataLab