estCdf {DstarM} | R Documentation |
Estimate cumulative distribution for D*M models
Description
Estimate cumulative distribution for D*M models
Usage
estCdf(x)
Arguments
x |
Any density function to calculate a cumulative distribution for.
The code is designed for input of class |
Details
Cumulative distributions functions are calculated by: cumsum(x) / sum(x)
.
This method works well enough for our purposes. The example below shows that the
ecdf
functions seems to work slightly better. However, this estimates a
cdf from raw data and does not transform a pdf into a cdf and is therefore not useful
for D*M models.
Value
Cumulative density function(s). If the input was a matrix, a matrix of cumulative density functions is returned.
Examples
x = rnorm(1000)
xx = seq(-5, 5, .1)
approx1 = stats::ecdf(x)(xx)
approx2 = estCdf(dnorm(xx, mean(x), sd(x)))
trueCdf = pnorm(xx)
matplot(xx, cbind(trueCdf, approx1, approx2), type = c('l', 'p', 'p'),
lty = 1, col = 1:3, pch = 1, bty = 'n', las = 1, ylab = 'Prob')
legend('topleft', legend = c('True Cdf', 'Stats Estatimation', 'DstarM Estimation'),
col = 1:3, lty = c(1, NA, NA), pch = c(NA, 1, 1), bty = 'n')
[Package DstarM version 0.4.0 Index]