# Create some data
set.seed(1234)
x <- rlnorm(100)
# Calculate the mad and its variance
mad.est <- mad(x)
mad.est
v.est <- varmad(x)
v.est
# Calculate an approximate 95% confidence interval for the true mad
mad.est + c(-1, 1) * qnorm(0.975) * sqrt(v.est)
Run the code above in your browser using DataLab