[R] yuen function of the WRS2 package
James Henson
jfhenson1 at gmail.com
Wed Aug 31 16:16:45 CEST 2016
Thanks,
The 'droplevels' statement works.
Best regards,
James Henson
On Tue, Aug 30, 2016 at 5:34 PM, William Dunlap <wdunlap at tibco.com> wrote:
> yuen does not work when there unused levels in the factors given to it.
>
>> yuen(GoalsGame ~ League, tr=0.2, data = SpainGer)
> Call:
> yuen(formula = GoalsGame ~ League, data = SpainGer, tr = 0.2)
>
> Test statistic: NaN (df = NA), p-value = NA
>
> Trimmed mean difference: NaN
> 95 percent confidence interval:
> NaN NaN
>
>> yuen(GoalsGame ~ League, tr=0.2, data = droplevels(SpainGer))
> Call:
> yuen(formula = GoalsGame ~ League, data = droplevels(SpainGer),
> tr = 0.2)
>
> Test statistic: 0.8394 (df = 16.17), p-value = 0.4135
>
> Trimmed mean difference: -0.11494
> 95 percent confidence interval:
> -0.405 0.1751
>
> Complain to WSR2's maintainer.
>> maintainer("WRS2")
> [1] "Patrick Mair <mair at fas.harvard.edu>"
>
>
>
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
>
> On Tue, Aug 30, 2016 at 2:07 PM, James Henson <jfhenson1 at gmail.com> wrote:
>>
>> Greetings R community,
>> Here is a small but perplexing problem with the ‘yuen’ function in the
>> ‘WRS2’ package.
>> I begin with the ‘eurosoccer’ data frame from the ‘WRS2’ package.
>> Then make a subset that contains only two Leagues Spain and Germany
>> (subset data frame is ‘SpainGer’). The ‘yuen’ function cannot read
>> the data in subset data frame ‘SpainGer’. My code is below.
>> Thanks you for your help.
>> James F. Henson
>>
>>
>> # Examples from 'Robust Statistical Methods on R Using the WRS2 Package’
>> # Robust t-test, and ANOVA (pages5-13)
>> library(WRS2)
>> data("eurosoccer")
>> class(eurosoccer)
>> print(eurosoccer)
>> library("digest")
>> library("DT")
>> datatable(eurosoccer)
>> str(eurosoccer)
>> # make a subset with only Spain and Germany
>> SpainGer <- subset (eurosoccer, subset = League =="Spain" | League ==
>> "Germany")
>> print(SpainGer)
>> class(SpainGer)
>> str(SpainGer)
>> # The 'yuen' function can not read the data in the subset data.frame
>> "SpainGer"
>> yuen(GoalsGame ~ League, tr=0.2, data = SpainGer)
>> # the 'yuen' function works on the orginioal data.frame
>> yuen(GoalsGame ~ League, tr=0.2, data = eurosoccer)
>> # the 'aov' function reads the data in the subset data.frame "SpainGer"
>> Goals.fit <- aov(GoalsGame ~ League, data = SpainGer)
>> summary(Goals.fit)
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
More information about the R-help
mailing list