Felix Schönbrodt

Dr. Dipl.-Psych.

Wilcox’s Robust Statistics: A new R package

[Update Aug 2013: For a fail safe installation routine, see this up-to-date post: Installation of the WRS package]

Recently I started to build a new package for R containing Wilcox’ collection of functions for robust statistics.

Wilcox provides 700+ functions for robust statistics, including:

  • robust correlations (e.g. percentage bend correlation)
  • robust measures of location and mean differences (e.g. Yuen’s test, trimmed mean test with bootstrapping)
  • bootstrapping routines for many indices. Using bootstrapping, asymmetric and non-parametric confidence intervals can be calculated
  •  etc …

I’ve simply put Wilcox’ functions into a package, so that the environment isn’t cluttered with 700+ functions. I also started to add some help functions (but until now there are really few).

The package is hosted on R-Forge. You can install the package directly in R by typing:

install.packages("WRS", repos="http://R-Forge.R-project.org")
Comments (11) | Trackback

11 Responses to “Wilcox’s Robust Statistics: A new R package”

  1. Conrad Zygmont says:

    Thank you for your work Felix!

    Could you let me know if you were using the 2nd or 3rd edition of Wilcox’ book?

    I have just recently started using the script, but found the TBS and RMBA estimators not to work in the out function.

    Anyways, thank you for your effort!

    Kind Regards,
    Conrad

  2. FelixS says:

    Hi Conrad, these functions are constantly updated by Rand Wilcox, so they do not fit to a specific edition of his books. If you think you found an error you could send me a reproducible example and I’ll try to fix the bug …

    The package has been updated to version 0.20 yesterday (see here), so maybe they work now?

    Cheers, Felix

  3. Conrad Zygmont says:

    Hi Felix,

    All the best for the new year!

    I see that all the estimators listed in the out help file are now working with the latest release, except for the TBS estimator (cov.roc)

    The way I am using the command is as follows:

    > library(WRS)
    Loading required package: MASS
    Loading required package: akima
    Loading required package: robustbase

    Attaching package: ‘WRS’

    The following object(s) are masked from ‘package:robustbase':

    hard.rejection

    The following object(s) are masked from ‘package:stats':

    ecdf

    The following object(s) are masked from ‘package:grDevices':

    bmp

    > out(SOC.listwise, cov.fun = cov.roc, plotit= T)
    Error in out(SOC.listwise, cov.fun = cov.roc, plotit = T) :
    object ‘cov.roc’ not found

    Kind Regards,
    Conrad

    • FelixS says:

      Hi Conrad,
      indeed that seems to be a bug. cov.roc works for unidimensional vectors, but not for matrices. I submitted the bug to Wilcox, I’m sure he will take care about it soon! I will write in this thread when it’s fixed.

      Here’s a reproducible example: y works, x not:

      y <- c(rnorm(100), 3, 3.6, 7, 4)
      x <- matrix(c(rnorm(100), 3, 3.6, 7, 4), ncol=2)
      library(WRS)

      out(x, cov.fun=cov.mve, plotit=TRUE)
      out(x, cov.fun=cov.mcd, plotit=TRUE)
      out(x, cov.fun=covmba2, plotit=TRUE)
      out(x, cov.fun=rmba, plotit=TRUE)
      out(x, cov.fun=cov.roc, plotit=TRUE)

      Cheers,
      Felix

      • FelixS says:

        Hi, Rand Wilcox fixed the bug – should work now!
        WRS package is updated on R-Forge, the binary should be available tomorrow.
        Felix

  4. Conrad Zygmont says:

    Hi Felix,

    Thank you for your feedback. I can confirm that it works now on my side as well ;)
    Please convey my thanks to Rand as well.

    Kind Regards,
    Conrad Zygmont

  5. Iris says:

    Dear Felix!

    When I try to install the package WRS using following command:

    —————————————————————
    install.packages(“WRS”, repos=”http://R-Forge.R-project.org”)
    —————————————————————

    I get following message:

    —————————————————————
    Installing package into ‘C:/Users/Iris/Documents/R/win-library/3.0’
    (as ‘lib’ is unspecified)

    package ‘WRS’ is available as a source package but not as a binary

    Warning message:
    package ‘WRS’ is not available (for R version 3.0.0)
    —————————————————————-

    Would I need to use a different version of R to run the package?

    Thank you and kind regards,
    Iris

    • FelixS says:

      Hi Iris,
      I uploaded a fixed version to R-Forge; by tomorrow it should work (when the next built cycle has run).
      Could you give me a short note if it works on your machine?

      Meanwhile, you could also try install.packages(“WRS”, repos=”http://R-Forge.R-project.org”, type=”source”). This might work. Or you wait until tomorrow.

      F

    • FelixS says:

      If you still have troubles installing WRS: I posted an installation procedure that should be fail-safe

  6. Ben says:

    Dear Felix,

    I have the same problem as Iris on the 10th of April had (WRS package not available for R 3.0.1). I’ve had this problem three days in a row… I have installed all three required packages without trouble.
    Can you help me?

    Kind regards

    Ben

Leave a Reply