From cberry at tajo.ucsd.edu  Mon Dec 14 23:08:12 2009
From: cberry at tajo.ucsd.edu (Charles C. Berry)
Date: Mon, 14 Dec 2009 14:08:12 -0800
Subject: [Rd] New version weighted mean differs from the old one
	(PR#14142)
In-Reply-To: <20091214202510.BF0DA282EF29@mail.pubhealth.ku.dk>
References: <20091214202510.BF0DA282EF29@mail.pubhealth.ku.dk>
Message-ID: <Pine.LNX.4.64.0912141407220.5999@tajo.ucsd.edu>



This was PR#14032. Fixed in R.10.1.


On Mon, 14 Dec 2009, huh420 at dreamwiz.com wrote:

> Full_Name: Myung-Hoe Huh
> Version: 2.10
> OS: Windows
> Submission from: (NULL) (116.120.84.194)
>
>
> New Version (2.10.0) weighted mean produces unreasonable result: see below.
>
>     wt <- c(5,  5,  4,  1)/15
>     x <- c(3.7,3.3,3.5,2.8)
>     x[4] <- NA
>     (xm <- weighted.mean(x,wt,na.rm=T))
>
> Outcome is
>
>>      (xm <- weighted.mean(x,wt,na.rm=T))
> [1] 3.266667
>
> The number is obtained by treating x[4] <- 0
>
> I think the old version(2.8.0)'s weighte mean is more reasonable. The old output
> was
>
>>      (xm <- weighted.mean(x,wt,na.rm=T))
> [1] 3.5
>
> The number si obtained ignoring the x[4], which is NA.
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901



[Rd] New version weighted mean differs from the old one (PR#14142)
Charles C. Berry