library(densEstBayes) ; data(OldFaithful2011)
# Obtain a density estimate for the `OldFaithful2011' data:
dest <- densEstBayes(OldFaithful2011,method = "SMFVB")
# Plot the density estimate using default settings:
plot(dest,xlab = "time interval between geyser eruptions (minutes)")
rug(jitter(OldFaithful2011,amount=0.2),col = "dodgerblue")
# Plot the density estimate with some user-specified settings:
plot(dest,credLev = 0.999,estCol = "purple",
varBandCol = "pink",axisCol = "navy",
xlab = "time interval between geyser eruptions (minutes)")
rug(jitter(OldFaithful2011,amount= 0.2),col = "darkkhaki")
# Plot the density estimate as a black and white line plot:
plot(dest,estCol = "black",shade = FALSE,axisCol = "black",
xlab = "time interval between geyser eruptions (minutes)")
rug(jitter(OldFaithful2011,amount = 0.2))
Run the code above in your browser using DataLab