bridgedist
Basicslibrary(bridgedist)
## The argument `scale` has been replaced with `phi` in this version.
## The top of page 77o in Wang Louis 2003 states phi is not a scale.
## Please start using the `phi` argument now.
Recreate the plot from Wang and Louis (2003) where the Bridge, Normal, and Logistic all have unit variance and mean 0 with ggplot2:
library(reshape2)
library(ggplot2)
= seq(-4,4,.01)
xaxis = data.frame( xaxis,
df Bridge = dbridge(xaxis, phi=1/sqrt(1+3/pi^2)),
Normal = dnorm(xaxis),
Logistic = dlogis(xaxis, scale=sqrt(3/pi^2)))
<- melt(df, id.vars = "xaxis")
melt.df colnames(melt.df) <- c("x", "Distribution", "value")
ggplot(melt.df, aes(x, value, color=Distribution)) +
geom_line(size=1.05) +
ylab("Probability density function")
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
The implication is that a random variable from a Bridge distribution plus random variable from a standard logistic distribution is a logistic random variable with a scale greater than one (1/phi).
<- 0.5
phi = data.frame(
df Bridge = rbridge(1e5, phi=phi),
Std_Logistic = rlogis(1e5),
BridgePlusStd_Logistic = rbridge(1e5, phi=phi) + rlogis(1e5),
Logistic = rlogis(1e5, scale=1/phi)
)<- melt(df)
melt.df colnames(melt.df) <- c("Distribution", "value")
ggplot(melt.df, aes(value)) +
facet_grid(.~Distribution) +
geom_histogram()