# easiOrigin
## Regression Coefficients
### Confidence Intervals
.ciCoefficients <- function(x, ...) {
UseMethod(".ciCoefficients")
}
.ciCoefficients.formula <- function(formula, conf.level = .95, ...) {
object <- lm(formula, ...)
.ciCoefficients(object, conf.level = conf.level)
}
.ciCoefficients.lm <- function(object, conf.level = .95, ...) {
summ <- summary(object)
desc <- summ$coef[, c(1, 2)]
df <- object$df.residual
ci <- confint(object, level = conf.level)
results <- cbind(desc, df, ci)
colnames(results) <- c("Est", "SE", "df", "LL", "UL")
results
}
ciCoefficients <- function(..., conf.level = .95, main = NULL, digits = 3) {
results <- .ciCoefficients(..., conf.level = conf.level)
if (is.null(main)) {
main <- "Confidence Intervals for the Coefficients"
}
.formatList(list(results), main = main, digits = digits)
}
### Null Hypothesis Signifcance Tests
.nhstCoefficients <- function(x, ...) {
UseMethod(".nhstCoefficients")
}
.nhstCoefficients.formula <- function(formula, ...) {
object <- lm(formula, ...)
.nhstCoefficients(object)
}
.nhstCoefficients.lm <- function(object, ...) {
summ <- summary(object)
desc <- summ$coef[, c(1, 2, 3)]
df <- object$df.residual
inf <- summ$coef[, 4]
results <- cbind(desc, df, inf)
colnames(results) <- c("Est", "SE", "t", "df", "p")
results
}
nhstCoefficients <- function(..., main = NULL, digits = 3) {
results <- .nhstCoefficients(...)
if (is.null(main)) {
main <- "Hypothesis Tests for the Coefficients"
}
.formatList(list(results), main = main, digits = digits)
}
### Analyze Meta Function
.analyzeCoefficients <- function(..., conf.level = .95) {
ci <- .ciCoefficients(..., conf.level = conf.level)
nhst <- .nhstCoefficients(...)
cbind(ci[, 1:2], ci[, 4:5], nhst[, 3:5])
}
analyzeCoefficients <- function(..., main = NULL, digits = 3) {
results <- .analyzeCoefficients(...)
if (is.null(main)) {
main <- "Model Coefficients"
}
.formatList(list(results), main = main, digits = digits)
}
### Confidence Interval Plots
graphCoefficients <- function(x, ...) {
UseMethod("graphCoefficients")
}
graphCoefficients.formula <- function(formula, main = NULL, ylab = "Coefficients", xlab = "", mu = NULL, rope = NULL, conf.level = .95, values = TRUE, ylim = NULL, digits = 3, pch = 16, col = "black", ...) {
results <- .ciCoefficients(formula, conf.level = conf.level)[, c("Est", "LL", "UL")]
if (is.null(main)) {
main <- "Confidence Intervals for the Coefficients"
}
.cipMain(results, main = main, ylab = ylab, xlab = xlab, mu = mu, rope = rope, values = values, ylim = ylim, digits = digits, connect = FALSE, pch = pch, col = col)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.