Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #746

Re: Wrong mean (stats) and wrong column number

From Péter Juhász <peter.juhasz83@gmail.com>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: Wrong mean (stats) and wrong column number
Date 2011-12-13 02:53 -0800
Organization http://groups.google.com
Message-ID <8316e08c-3cd5-418a-ada6-3ebea582bd5a@z1g2000vbx.googlegroups.com> (permalink)
References <b226cee0-9900-4b2c-8d50-ea19c83272b8@w3g2000vbw.googlegroups.com>

Show all headers | View raw


On Dec 13, 11:37 am, Andreas Heindl <andreas.hei...@gmail.com> wrote:
> Hi!
>
> Today I encountered a strange problem with gnuplot 4.5 patchlevel 0. I
> have a file containing three colums (seperated by tabs)
>
> Column 1: n=15
> Column 2: n=15
> Column 3: n=30
>
> I calculated the mean and stdev via OpenOffice Calc for each of the
> columns as well as via
>
> stats 'MyInputFile.txt' using 1 name "A"      #1
> #do some plotting
> stats 'MyInputFile.txt' using 2 name "A"      #2
> #do some plotting
> stats 'MyInputFile.txt' using 3 name "A"      #3
>
> First I noticed that column 1 (statement #1) has 30 records which is
> strange because it only contains 15 elements.
>
> FILE:
>   Records:      30
>   Out of range:  0
>   Invalid:       0
>   Blank:         0
>   Data Blocks:   1
>
> Second I'm puzzled, assuming the numbering starts from the back, why
> mean and stdev are completely different from those computed by
> OpenOffice. The only mean / stdev value that is correct is the one
> from statement #2.
>
> Any hints? I'm stuck currently ...
> Thanks,
> Andreas

Did you set the column separator correctly?

By default gnuplot splits lines on whitespace - any amount of
whitespace.
This means that the two tab characters intended to mean two empty
values after the 15th line will be ignored and the single meaningful
value found in the lines will be read as in they were in the first
column.

Try saving the file as a comma (or semicolon) separated file, then in
gnuplot issue 'set datafile separator ";"' before plotting.

Péter Juhász

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Find similar


Thread

Wrong mean (stats) and wrong column number Andreas Heindl <andreas.heindl@gmail.com> - 2011-12-13 02:37 -0800
  Re: Wrong mean (stats) and wrong column number Péter Juhász <peter.juhasz83@gmail.com> - 2011-12-13 02:53 -0800

csiph-web