R/stdz.r

Defines functions stdz

Documented in stdz

stdz <- function(x, weight=NULL){
  if(is.null(weight)){
    weight <- rep(1, length(x))
  }
  x <- x-wtd.mean(x, weight, na.rm=TRUE)
  x <- x/sqrt(wtd.var(x, weight, na.rm=TRUE))
  x
}

Try the weights package in your browser

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

weights documentation built on Feb. 12, 2020, 5:56 p.m.