winsorZ {scipub} | R Documentation |
Winsorize outliers based on z-score cutoff to next most extreme non-outlier value
Description
The winsorZ
function identifies outliers based on Z-score cutoff
and replaces with the next most extreme non-outlier value.
This involves z-scoring the variable and identifying/replacing
any cases beyond the z-score threshold.
The winsorZ_find
function is an optional companion
to flag any Z-score outliers to tally as needed.
Usage
winsorZ(x, zbound = 3)
Arguments
x |
The input variable to Winsorize. |
zbound |
The Z-score cutoff (default=3, i.e. outliers are Z>3 | Z<-3). |
Value
Output Winsorized variable
Examples
winsorZ(psydat$iq)
## Not run:
psydat %>%
dplyr::select(c(iq, anxT)) %>%
map(winsorZ)
psydat %>% mutate_at(c("iq", "anxT"), list(~ winsorZ(.)))
psydat %>% mutate_if(is.double, list(~ winsorZ(.)))
## End(Not run)
[Package scipub version 1.2.3 Index]