# Estimation Approach to Statistical Inference
## Data Summaries and Plots
### Summary Functions
fnsData <- function(x,...)
UseMethod("fnsData")
fnsData.default <- function(...) {
data <- data.frame(...)
results <- do.call(rbind,lapply(data,function(x) boxplot.stats(x)$stats))
results <- round(results,3)
colnames(results) <- c("Lower Whisker","Lower Hinge","Median","Upper Hinge","Upper Whisker")
return(results)
}
fnsData.formula <- function(formula,...) {
results <- aggregate(formula,FUN=fnsData,...)
rn <- results[,1]
results <- results[[2]]
rownames(results) <- rn
colnames(results) <- c("Lower Whisker","Lower Hinge","Median","Upper Hinge","Upper Whisker")
return(results)
}
#### Plot Functions for Boxes
bpData <- function(x,...)
UseMethod("bpData")
bpData.default <- function(...,main=NULL,ylab="Outcome",xlab="") {
if(is.null(main)) {main="Boxplots for the Data"}
data <- data.frame(...)
par(bty="l")
boxplot(data,boxwex=.15,cex=1.5,cex.lab=1.3,xlab=xlab,ylab=ylab,main=main,...)
}
bpData.formula <- function(formula,main=NULL,ylab="Outcome",xlab="",...) {
if(is.null(main)) {main="Boxplots for the Data"}
par(bty="l")
boxplot(formula,boxwex=.15,cex=1.5,cex.lab=1.3,xlab=xlab,ylab=ylab,main=main,...)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.