#' @title Function for Estimating Expected Type II Error Rates
#'
#' @description This function returns the likelihood od type II errors (beta errors) for multiple linear regressions given their sample size.
#' @param x A glm object of family "gaussian".
#' @export
#' @keywords beta error, type II error, multiple linear regression, linear regression
#' @return NULL
#' @examples \dontrun{
#' model.glm = glm(depvar ~ indepvar, data = data, family = gaussian)
#' expR(model.glm)
#' }
expR <- function(x) {
ifelse(((ncol(summary(x)$coefficients)-1)/(length(x$fitted)-1)) > .05,
return(paste("A random sample is expected to cause a correlation of the size",
((ncol(summary(x)$coefficients)-1)/(length(x$fitted)-1)),
"between the predictors and the predicted", collapse = "")),
return(paste("Based on the sample size expect a false positive correlation of",
round(((ncol(summary(x)$coefficients)-1)/(length(x$fitted)-1)), 4),
"between the predictors and the predicted",
collapse = "")))}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.