Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
55 lines (43 sloc) 1.55 KB
#
# cum-prob-distrib.R, 13 Apr 20
# Data from:
# Example
#
# Example from:
# Evidence-based Software Engineering: based on the publicly available data
# Derek M. Jones
#
# TAG example
source("ESEUR_config.r")
plot_layout(4, 1)
par(mar=MAR_default-c(2.0, 3.5, 0, 0))
brew_col=rainbow(3)
plot(c(0, 1,1, 2,2, 3,3, 4,4, 5), c(0, 0, 0.25,0.25, 0.5,0.5, 0.75,0.75, 1, 1), type="l",
col=brew_col[1],
xlab="", ylab="")
x_geom=0:10
plot(x_geom, pgeom(x_geom, prob=0.2),
col=brew_col[1],
xlim=range(x_geom), ylim=c(0, 1),
xlab="", ylab="")
points(x_geom, pgeom(x_geom, prob=0.4), col=brew_col[2])
points(x_geom, pgeom(x_geom, prob=0.6), col=brew_col[3])
legend(x="bottomright", legend=c("prob=0.2", "prob=0.4", "prob=0.6"), bty="n", fill=brew_col, cex=1.2)
x_binom=0:10
plot(x_binom, pbinom(x_binom, size=10, prob=0.2),
col=brew_col[1],
xlim=range(x_binom), ylim=c(0, 1),
xlab="", ylab="")
points(x_binom, pbinom(x_binom, size=10, prob=0.4), col=brew_col[2])
points(x_binom, pbinom(x_binom, size=25, prob=0.2), col=brew_col[3])
legend(x="bottomright", legend=c("size=10\nprob=0.2\n", "size=10\nprob=0.4\n", "size=25\nprob=0.2"), bty="n", fill=brew_col, cex=1.2)
lambda_str=function(num) as.expression(substitute(lambda == num))
x_pois=0:10
plot(x_pois, ppois(x_pois, lambda=2),
col=brew_col[1],
xlim=range(x_pois), ylim=c(0, 1),
xlab="", ylab="")
points(x_pois, ppois(x_pois, lambda=4), col=brew_col[2])
points(x_pois, ppois(x_pois, lambda=7), col=brew_col[3])
legend(x="bottomright", legend=c(lambda_str(2), lambda_str(4), lambda_str(7)),
bty="n", fill=brew_col, cex=1.2)