View source: R/radiocarbon-functions.R
SummariseEmpiricalPDF | R Documentation |
Summarise an Empirical Probability Distribution Function.
SummariseEmpiricalPDF(x, p)
x |
A vector of values of empirical PDF |
p |
A vector of probabilities |
Calculation of the mode is naive. For a multimodal distribution only the highest is returned, in the case of 2 or more modes with exactly the same probability, the first is returned.
Returns a named vector with the mean, median, mode, and standard deviation of the empirical PDF
## Not run:
df <- data.frame(x = 1:10)
df$p <- dnorm(df$x, 5, 2)
hamstr:::SummariseEmpiricalPDF(df$x, df$p)
x <- 1:100
y <- dnorm(x, 50, 10)
plot(x, y)
SummariseEmpiricalPDF(x, y)
x2 <- x[c(1:50, seq(51, 70, 3), seq(71, 100, 1))]
y2 <- y[x2]
plot(x2, y2)
SummariseEmpiricalPDF(x2, y2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.