R/ss.R

#' @encoding UTF-8
#' @title Sum of Squared deviations from the mean and sum of Absolute Deviations from the median
#' 
#' @description
#' Functions to compute Sum of Squared deviations from the mean and sum of Absolute Deviations from the median.
#'
#' @param x A numeric vector.
#'
#' @return Sum of Squared deviations from the mean or sum of Absolute Deviations from the median.
#'
#' @author \enc{Aleš Žiberna}{Ales Ziberna}
#' @keywords univar
#' @importFrom stats median
#' 
#' @export

"ss" <-
function(x){sum(x^2)-sum(x)^2/length(x)}

#' @rdname ss
#' 
#' @export

"ad" <-
function(x)sum(abs(x-median(x)))

Try the blockmodelingRoxygen2 package in your browser

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

blockmodelingRoxygen2 documentation built on June 9, 2020, 3:30 p.m.