Ask Your Question

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- on windows with the following data:


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

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


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


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, and

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

Question Tools

1 follower


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

Seen: 116 times

Last updated: Dec 20 '18