R/se_rxy.R

Defines functions se_rxy

Documented in se_rxy

#' @rdname se_meanx
#' @export
se_rxy <- function(x, y, na.rm = FALSE) {
  if (na.rm) {
    i <- stats::complete.cases(x, y)
    x <- x[i]
    y <- y[i]
  }
  root_n <- sqrt(length(x))
  r <- stats::cor(x, y)
  (1 - r^2) / root_n
}

Try the probstats4econ package in your browser

Any scripts or data that you put into this service are public.

probstats4econ documentation built on Sept. 11, 2024, 8:29 p.m.