get_probvals: Calculate probability of ordered discrete states using a...

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/BioGeoBEARS_basics_v1.R

Description

This function is calculates the Maximum Entropy (Harte (2011)) discrete probability distribution of a number of ordered states (e.g., faces of a 6-sided die) given the mean of many rolls. Here, this is merely used so that a single parameter can control the probability distribution of small versus large descendant areas during cladogenesis. This function could then used by relative_probabilities_of_subsets in BioGeoBEARS to weight different descendant range sizes (although, currently, the function maxent from the FD package is used).

Usage

1
  get_probvals(die_vals, meanval)

Arguments

die_vals

Values of the ordered discrete variable state (e.g., seq(1,6) for a six-sided die)

meanval

Mean value (the knowledge supplied to the MaxEnt function).

Details

This calculation is based on Equations 6.3-6.4 of Harte (2011).

See also: Maximum Entropy probability distribution for discrete variable with given mean (and discrete uniform flat prior) http://en.wikipedia.org/wiki/Maximum_entropy_probability_distribution

Value

Prob_nvals, numeric values of the probability of each state from die_vals.

Note

Go BEARS!

Author(s)

Nicholas J. Matzke matzke@berkeley.edu

References

http://phylo.wikidot.com/matzke-2013-international-biogeography-society-poster http://en.wikipedia.org/wiki/Maximum_entropy_probability_distribution

Harte2011

Matzke_2012_IBS

See Also

calcZ_part, calcP_n, maxent, symbolic_to_relprob_matrix_sp, relative_probabilities_of_subsets

Examples

 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
testval=1
# Examples
# Set up subplots
par(mfrow=c(3,2))

# Flat distribution (equal prob of any descendent size)
N = 6
# n = die_vals
die_vals = seq(1,N)
meanval = 3.5
probvals = get_probvals(die_vals, meanval)
probvals
barplot(height=probvals, width=1, names.arg=die_vals, ylim=c(0,1))
title(paste("Probabilities of each state, mean val=", meanval, sep=""))

# Descendents tend to have large ranges
N = 6
# n = die_vals
die_vals = seq(1,N)
meanval = 5.999
probvals = get_probvals(die_vals, meanval)
probvals
barplot(height=probvals, width=1, names.arg=die_vals, ylim=c(0,1))
title(paste("Probabilities of each state, mean val=", meanval, sep=""))

# Flat distribution (equal prob of any descendent size)
N = 6
# n = die_vals
die_vals = seq(1,N)
meanval = 5
probvals = get_probvals(die_vals, meanval)
probvals
barplot(height=probvals, width=1, names.arg=die_vals, ylim=c(0,1))
title(paste("Probabilities of each state, mean val=", meanval, sep=""))

# Flat distribution (equal prob of any descendent size)
N = 6
# n = die_vals
die_vals = seq(1,N)
meanval = 4
probvals = get_probvals(die_vals, meanval)
probvals
barplot(height=probvals, width=1, names.arg=die_vals, ylim=c(0,1))
title(paste("Probabilities of each state, mean val=", meanval, sep=""))

# Flat distribution (equal prob of any descendent size)
N = 6
# n = die_vals
die_vals = seq(1,N)
meanval = 2
probvals = get_probvals(die_vals, meanval)
probvals
barplot(height=probvals, width=1, names.arg=die_vals, ylim=c(0,1))
title(paste("Probabilities of each state, mean val=", meanval, sep=""))

# This produces the LAGRANGE default
# (all smaller descendents are of size 1)
N = 6
# n = die_vals
die_vals = seq(1,N)
meanval = 1.0001
probvals = get_probvals(die_vals, meanval)
probvals
barplot(height=probvals, width=1, names.arg=die_vals, ylim=c(0,1))
title(paste("LAGRANGE 'default', mean val=", meanval, sep=""))

# This is stopped by the error check
# (all smaller descendents are of size 1)
# N = 6
# # n = die_vals
# die_vals = seq(1,N)
# meanval = 0.5
# probvals = get_probvals(die_vals, meanval)
# probvals
# barplot(height=probvals, width=1, names.arg=die_vals, ylim=c(0,1))
# title(paste("Probabilities of each state, mean val=", meanval, sep=""))

BioGeoBEARS documentation built on May 29, 2017, 8:36 p.m.