Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [statistics]

For questions that relate to probability or measurements, either outputting or parsing.

Filter by
Sorted by
Tagged with
14 votes
3 answers
831 views

Sniff out biased random permutations

The brilliant engineers at <enter company you love to hate> have struck again. This time they've "revolutionised" the generation of random permutations. "Every great invention is ...
user avatar
  • 5,830
8 votes
12 answers
335 views

Repeat average‎

Background It was a normal presentation that I were in as a audience, until the presenter gave a math problem about repeat taking 2 number out of a list a replacing them with average, claiming that ...
user avatar
  • 1,367
15 votes
17 answers
790 views

Square chunk my matrix

Your challenge is to write a function/program that takes a matrix of integers m and a number n as input and: Splits m into n by n chunks Replaces each chunk with the most common value in that chunk (...
user avatar
  • 27.6k
29 votes
9 answers
3k views

Approximate when you are going to die

A mortality table or life table is an actuarial tool that gives the probability that a person aged \$A\$ years will die in the next year, and is used to help calculate the premiums for life insurance, ...
user avatar
  • 26.7k
14 votes
22 answers
1k views

Mode length of a sentence

The task is simple. You are given a string with alphabetical words (say "Hello world, this are tests"). You have to return the mode of the lengths of ...
user avatar
  • 2,850
18 votes
82 answers
5k views

Average Two Letters

Introduction Every letter in the English alphabet can be represented as an ASCII code. For example, a is 97, and ...
user avatar
  • 2,035
9 votes
11 answers
754 views

Olympic game scoring [closed]

The challenge is to write a golf-code program that, given n positive real numbers from 0 to 10 (format x.y, y only can be 0 or 5: 0, 0.5, 1, 1.5, 2, 2.5 … 9.5 and 10), discard the lowest and highest ...
user avatar
  • 169
16 votes
9 answers
1k views

Fivenum and a little bit

(a paradox, a paradox, a most ingenious paradox) This is the first part of a multipart series inspired by different R functions. The Task Given a dataset \$D\$ of positive integers, I need you to ...
user avatar
  • 26.7k
3 votes
5 answers
2k views

Average Idle-Dice Rolling

So I ran into this progressive/idle game cleverly called Idle Dice. Has a variety of random effects applied to a pretty typical progression formula game. Warning, time sink! Play at your own risk. ...
user avatar
14 votes
26 answers
1k views

Standardize the Samples (Compute the z-Score)

Given a list of floating point numbers, standardize it. Details A list \$x_1,x_2,\ldots,x_n\$ is standardized if the mean of all values is 0, and the standard deviation is 1. One way to compute this ...
user avatar
  • 43k
7 votes
4 answers
635 views

Ordinary Least Squares Regression

I am quite surprised that a variant of linear regression has been proposed for a challenge, whereas an estimation via ordinary least squares regression has not, despite the fact the this is arguably ...
user avatar
10 votes
26 answers
2k views

Weighted average - the pressup trend problem

Let's say that this array is how many press-ups I've achieved each day in the last 28 days: ...
user avatar
  • 11.1k
17 votes
4 answers
448 views

Cross-Alphabetic Characters

Background I saw this very interesting Venn Diagram on wikipedia: https://simple.wikipedia.org/wiki/Alphabet#/media/File:Venn_diagram_gr_la_ru.svg It shows the letters (physical shapes) in different ...
user avatar
24 votes
22 answers
2k views

Frequency Distribution of Mixed Dice Rolls

A follow-up to this challenge Given a set of mixed dice, output the frequency distribution of rolling all of them and summing the rolled numbers on each die. For example, consider ...
user avatar
6 votes
4 answers
308 views

Find the smallest number of participants with resulting percentages

Programs often list outcome statistics, such as this: 54% of participants received an award 69% of participants got a promotion 85% of participants increased their salary These percentages are the ...
user avatar
17 votes
36 answers
2k views

An Array of Challenges #3: Moving Averages

Note: This is #3 in a series of array-manipulation challenges. For the previous challenge, click here. Moving Average of a List The moving average of a list is a calculation resulting in a new, ...
user avatar
  • 13.9k
13 votes
17 answers
1k views

Ten-row bar chart

This is Hole-1 from The Autumn Tournament of APL CodeGolf. I am the original author of the problem there, and thus allowed to re-post it here. Given a list of numbers, produce a horizontal bar chart ...
user avatar
  • 27.2k
23 votes
22 answers
2k views

Frequency Distribution of Multiple Dice Rolls

Given two positive integers a and b, output the frequency distribution of rolling a b-sided ...
user avatar
13 votes
4 answers
402 views

Rank Correlation Coefficient

The usual correlation coefficient (in 2d) measures how well a set of points can be described by a line, and if yes, its sign tells us whether we have a positive or negative correlation. But this ...
user avatar
  • 43k
7 votes
4 answers
700 views

Let's play POKE!

Poke is a really simple incomplete-information game. It's like "Poker", but simpler. At the start of every round, each player is dealt a hand. To simplify things, a hand is a uniformly distributed ...
user avatar
27 votes
5 answers
2k views

Fake Statistics

If you're going to invent some fake news, you'll want to fabricate some data to back it up. You must already have some preconceived conclusions and you want some statistics to strengthen the argument ...
user avatar
33 votes
56 answers
4k views

Compute the Median

Challenge Given a nonempty list of real numbers, compute its median. Definitions The median is computed as follows: First sort the list, if the number of entries is odd, the median is the value in ...
user avatar
  • 43k
15 votes
16 answers
630 views

Compute the Wilson score interval

The Wilson score interval is a confidence interval of the probability of success, based on the proportion of successes in a set of Bernoulli trials (a Bernoulli trial is a trial in which exactly two ...
user avatar
3 votes
3 answers
183 views

Correlation Coefficient of Words [closed]

This is going to be relatively quick... Challenge Given a lower-case word as input, calculate the Pearson's Correlation Coefficient between the letter position of the word (nth letter within the ...
user avatar
7 votes
5 answers
507 views

Fun with strings and string lengths

Introduction Inspired by Dyalog Ltd.'s 2016 student competition. The challenge there is to write good APL code, but this is a code-golf and it is open to all languages. Derived from this closed ...
user avatar
  • 27.2k
25 votes
22 answers
2k views

Interquartile Mean

Task Given (by any means) a sorted floating point dataset, return (by any means and within 1‰ of the correct value) the interquartile mean. One possible algorithm Discard the lowest and highest ...
user avatar
  • 27.2k
30 votes
43 answers
3k views

Mean bits: an average challenge

Given an integer N >= 1, output the mean number of bits in an integer from 0 to N - 1 Specification The output can be calculated as the sum of the number of bits in the binary representation of each ...
user avatar
  • 10.7k
-1 votes
2 answers
232 views

Restricted average (arithmetic mean) – i.e. without obvious built-ins [closed]

Introduction The arithmetic mean is defined as being equal to the sum of the numerical values of each and every observation divided by the total number of observations. Symbolically, if we have a ...
user avatar
  • 27.2k
12 votes
1 answer
405 views

Iterated Moving Average

If we have a list, say the list [9, 2, 4, 4, 5, 5, 7], we can do a moving average across it. Taking a window of say, 3 elements, each element is replaced by a ...
user avatar
  • 25.5k
11 votes
4 answers
523 views

Cause maximal disruption to a Straw Poll

Context Straw Poll is a website that is meant for the creation of simple/informal polls. Provided with a list of options, the user can select their choice(s), and the votes are tallied up. There's ...
user avatar
  • 28.5k
12 votes
6 answers
1k views

A Free Sample of Autocorrelation

Consider a 1-dimensional, real-valued vector x that represents observations of some process measured at equally spaced intervals over time. We call x a time series. Let n denote the length of x and ...
user avatar
  • 24.2k
35 votes
2 answers
1k views

The PPCG Handicap System

As we all know, meta is overflowing with complaints about scoring code-golf between languages (yes, each word is a separate link, and these may be just the tip of the iceberg). With so much jealousy ...
user avatar
  • 9,336
8 votes
1 answer
5k views

Calculate the average and standard deviation, rubiks cube style

Introduction When solving a rubiks cube, one often write down the times like this 11.91, (11.28), (12.32) This is called a average of 3, while a average of 5 ...
user avatar
21 votes
32 answers
3k views

Calculate Standard Deviation

Challenge Given a list of numbers, calculate the population standard deviation of the list. Use the following equation to calculate population standard deviation: Input The input will a list of ...
user avatar
  • 22.8k
8 votes
9 answers
702 views

Calculate the correlation coefficient

Given a series of numbers for events X and Y, calculate Pearson's correlation coefficient. The probability of each event is equal, so expected values can be calculated by simply summing each series ...
user avatar
  • 16.4k