Closed MichaelChirico closed 4 years ago
From: Dirk Eddelbuettel <edd@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>> On Wed, Oct 15, 2003 at 01:20:04AM +0200, r.huggins@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::> wrote:
Full_Name: Richard Huggins
Version: 1.7.1
OS: windows 2000
Submission from: (NULL) (131.172.4.44)
> x<-rnorm(100,2,1)
> mean(x)
[1] 1.73299
> summary(fivenum(x))
Min. 1st Qu. Median Mean 3rd Qu. Max.
-0.3655 1.1070 1.7430 1.7320 2.3840 3.7910
> summary(x)
Min. 1st Qu. Median Mean 3rd Qu. Max.
-0.3655 1.1070 1.7430 1.7330 2.3830 3.7910
> y<-log(abs(x))
> summary(fivenum(y))
Min. 1st Qu. Median Mean 3rd Qu. Max.
-3.5950 0.1020 0.5555 -0.1472 0.8688 1.3330
> mean(y)
[1] 0.2878568
> summary(y)
Min. 1st Qu. Median Mean 3rd Qu. Max.
-3.5950 0.1021 0.5555 0.2879 0.8683 1.3330
summary(fivenum(x)) gives the wrong mean
I think you may be misunderstanding what is happening -- fivenum() returns a simple vector of five numbers, which summary then summarises.
It so happens that for an (approx.) symmetrically distributed sample x as the one you drew from the N(2,1), mean(summary(x)) is still approx. mean(x) (and identical asymptocally). That no longer holds once you take logs(abs()). As so often, it helps to simply plot the data as you could with
boxplot(x,summary(x),fivenum(x),y,summary(y),fivenum(y),horizontal=TRUE)
Hth, Dirk
-- Those are my principles, and if you don't like them... well, I have others. -- Groucho Marx
Audit (from Jitterbug): Wed Oct 15 02:14:47 2003 thomas moved from incoming to feature&FAQ
From: r.huggins@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::> Full_Name: Richard Huggins Version: 1.7.1 OS: windows 2000 Submission from: (NULL) (131.172.4.44)
[1] 1.73299
Min. 1st Qu. Median Mean 3rd Qu. Max. -0.3655 1.1070 1.7430 1.7320 2.3840 3.7910
Min. 1st Qu. Median Mean 3rd Qu. Max. -0.3655 1.1070 1.7430 1.7330 2.3830 3.7910
Min. 1st Qu. Median Mean 3rd Qu. Max. -3.5950 0.1020 0.5555 -0.1472 0.8688 1.3330
[1] 0.2878568
Min. 1st Qu. Median Mean 3rd Qu. Max. -3.5950 0.1021 0.5555 0.2879 0.8683 1.3330
summary(fivenum(x)) gives the wrong mean
METADATA