
Last chance! 50% off unlimited learning
Sale ends in
This function computes ppeak
to compute
dpeak(k, n, usedata = FALSE)
A double between 0 and 1 representing the probability of exactly
k peaks occurring in a sequence of names
attribute with the values corresponding to the probabilities.
Computation time is very slow for
usedata
is FALSE
) and for
regardless of usedata
value.
An integer or a sequence of integers strictly incrementing by 1,
with all values between 0 and n - 1
inclusive. Represents the number
of peaks in the sequence.
A positive integer representing the number of observations in the sequence.
A logical. Should probability mass function values be
read from dpeakdat
rather than computing them? This option
will save significantly on computation time if
ppeak
, goldfeld_quandt
dpeak(0:9, 10)
plot(0:9, dpeak(0:9, 10), type = "p", pch = 20, xlab = "Number of Peaks",
ylab = "Probability")
# This would be extremely slow if usedata were set to FALSE:
prob <- dpeak(0:199, 200, usedata = TRUE)
plot(0:199, prob, type = "l", xlab = "Number of Peaks", ylab = "Probability")
# `dpeakdat` is a dataset containing probabilities generated from `dpeak`
utils::data(dpeakdat)
expval <- unlist(lapply(dpeakdat,
function(p) sum(p * 0:(length(p) - 1))))
plot(1:1000, expval[1:1000], type = "l", xlab = parse(text = "n"),
ylab = "Expected Number of Peaks")
Run the code above in your browser using DataLab