prior densities for truncated discrete random variable

Share:

Description

creating a prior density function for a truncated discrete random variable

Usage

1
dcount(x, FUN, ...)

Arguments

x

an integer vector spanning from the minimal to maximal values

FUN

a probability density function (see Examples)

...

additional arguments to be passed to FUN

Author(s)

JM Eastman

See Also

make.gbm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
range=0:100
u=dcount(range, FUN=dunif, min=min(range), max=max(range))
g=dcount(range, FUN=dgeom, prob=0.05)
p=dcount(range, FUN=dtpois, min=min(range), max=max(range), lambda=0.5)
priors=list(pois=p, geom=g, unif=u)
plot(range(range), c(0,1), xlab="index", ylab="cumsum(prob)", type="n", bty="n")
for(i in 1:length(priors)){
	points(attributes(attributes(priors[[i]])$density)$cumsum, col=i, pch=22, cex=0.35)
}
legend("bottomright", bty="n", legend=names(priors), col=1:length(priors), pch=22)


## LN prior probabilities
print(u(0))	## dunif
print(g(0))	## dgeom
print(p(0)) ## dtpois

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.