From murdoch at stats.uwo.ca  Sun Oct 28 15:01:55 2007
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Sun, 28 Oct 2007 10:01:55 -0400
Subject: [Rd] meaning of "trim" in mean()
In-Reply-To: <47244B9A.8090108@pburns.seanet.com>
References: <39B6DDB9048D0F4DAD42CB26AAFF0AFA04D88433@usctmx1106.merck.com>	<4720993C.5030105@biostat.ku.dk>	<Pine.LNX.4.64.0710271814060.15370@gannet.stats.ox.ac.uk>
	<47244B9A.8090108@pburns.seanet.com>
Message-ID: <47249653.6000008@stats.uwo.ca>

On 28/10/2007 4:43 AM, Patrick Burns wrote:
> If the sentence in question were amended to:
> 
> Values of trim outside that range ...
> 
> then I think it would rule out the misinterpretation of
> the sentence.

Good suggestion.  I've changed it.

Duncan Murdoch

> 
> Pat
> 
> 
> Prof Brian Ripley wrote:
> 
>> There is only one _range_ mentioned, (0, 0.5).  I don't see how you can 
>> construe 'that range' to be a reference to anything other than (0, 0.5).
>>
>> And why do you suppose the description for argument 'trim' is referring to 
>> 'values' of a different argument?
>>
>> It is telling you what happens for values of trim < 0 or > 0.5: that is 
>> not information that it is appropriate to excise.
>>
>>
>> On Thu, 25 Oct 2007, Peter Dalgaard wrote:
>>
>>  
>>
>>> Liaw, Andy wrote:
>>>    
>>>
>>>> (I see this in both R-patched r43124 and R-devel r43233.)
>>>> In the Argument section of ?mean:
>>>>
>>>> trim     the fraction (0 to 0.5) of observations to be trimmed from each
>>>> end of x before the mean is computed. Values outside that range are
>>>> taken as the nearest endpoint.
>>>>
>>>> Then in the Value section:
>>>>
>>>> If trim is non-zero, a symmetrically trimmed mean is computed with a
>>>> fraction of trim observations deleted from each end before the mean is
>>>> computed.
>>>>
>>>> The description in "trim" to me sounds like Windsorizing, rather than
>>>> trimming.  Should that be edited?
>>>>
>>>>
>>>>      
>>>>
>>> I think so:
>>>
>>>    
>>>
>>>> x <- sort(rnorm(10))
>>>> mean(x,trim=.1)
>>>>      
>>>>
>>> [1] -0.6387413
>>>    
>>>
>>>> mean(x[2:9])
>>>>      
>>>>
>>> [1] -0.6387413
>>>    
>>>
>>>> mean(x[c(2,2:9,9)]) # Winsorizing
>>>>      
>>>>
>>> [1] -0.6204222
>>>
>>> So yes, it is trimming, not Winsorizing, and the last sentence in the
>>> description of "trim" is misleading and should be, well..., trimmed.
>>>
>>>
>>>    
>>>
>>  
>>
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] meaning of "trim" in mean()
Duncan Murdoch