Ask Your Question
0

Why does Data-Statistics-Sampling not randomly sample?

asked 2018-12-20 05:46:03 +0100

decuser gravatar image

updated 2018-12-20 05:48:56 +0100

I created a simple spreadsheet in libreoffice-6.1.4.2 on windows with the following data:

A
Vals
1
2
3
4

I then clicked on Data->Statistics->Sampling, and provided the following input:

Input Range: $Sheet1.$A$2:$A$5
Results to: $B$2
Checked Random
Sample size: 4

I then clicked OK. and got the following result:

A      B
Vals   Res
1       1
2       2
3       3
4       4

What's the problem? I expected column B to have 4 randomly selected values from column A...

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2018-12-20 19:08:31 +0100

erAck gravatar image

What do you expect? You draw 4 values (without duplicates!) out of a set of 4 available "population" values. If you want "more random" you need to provide a larger data set from which to sample 4.

edit flag offensive delete link more

Comments

I expect it to randomly select the four values. Something along the lines of:

B
Res
4
2
1
3

Which just happens to be what it does in Excel and other programs when you ask it to 'randomly' draw a sample.

decuser gravatar imagedecuser ( 2018-12-20 19:25:36 +0100 )edit

Ah you want the order to be random as well..

erAck gravatar imageerAck ( 2018-12-20 21:52:27 +0100 )edit

The sample is drawn WITHOUT replacement? That would explain what's going on, especially if LibreOffice is then sorting the resultant sample before giving it back. Excel doesn't do replacement or sorting of the result. Revise the answer to a more instructive tone and I'll gladly accept it.

decuser gravatar imagedecuser ( 2018-12-21 16:00:57 +0100 )edit

Calc does not sort the result. It keeps the order of the source data. Like if you randomly pick elements from data flowing by.

erAck gravatar imageerAck ( 2018-12-25 19:23:19 +0100 )edit

Anyway, in master/to-be-6.3 there's now also WithReplacement/WithOutReplacement toggles and KeepOrder/RealRandom implemented, https://gerrit.libreoffice.org/plugin... and https://gerrit.libreoffice.org/plugin...

erAck gravatar imageerAck ( 2018-12-25 19:28:05 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-12-20 05:46:03 +0100

Seen: 32 times

Last updated: Dec 20 '18