# Questions tagged [statistics]

Consider whether your question would be better asked at CrossValidated, a Stack Exchange site for probability, statistics, data analysis, data mining, and machine learning. Code Review questions on statistics should be about implementation and working program review, not about theoretical discussions of statistics or research design.

358 questions
Filter by
Sorted by
Tagged with
14 views

### Get mode of elements in a vector with rust - For loop borrowing and referencing [closed]

Before anyone marks this as duplicate, my question is only towards the median, and my approach is different from what the answer suggested. On getting the mode from a vector of values, I have the ...
1k views

### Kotlin function which counts standard deviation

Here is the code. The code should counts the standard deviation for double array, but also for Int arrays. ...
138 views

### Modelling of partcle flow under electric field

This is my first modeling exercise on the particle flow. Recently, I read a paper https://acp.copernicus.org/articles/20/3181/2020/. After reading the paper, thought of modeling it in Python. It seems ...
128 views

### Return probability (Javascript)

I've been working on a personal project. There's this game called TFT which is an autochess game. Each match is played by 8 players and there's a shared pool of champions. Each champion has their cost ...
58 views

### A Level Statistics Calculator/Helper For A Casio Fx-CG50 Calculator's MicroPython

I have made a program for my calculator's micropython, that can solve various a level statistics questions for me. However due to the limitations of the ...
9k views

### Calculate mean, median, and mode in Rust

I'm learning Rust using The Rust Programming Language. I'm trying the assignment at the end of chapter 8 — Hash Maps. The task is: Given a list of integers, use a vector and return the mean (...
38 views

### Calculate rolling mean and std over a pandas dataframe

I am trying to calculate the rolling mean and std of a pandas dataframe. So far I'm here: ...
109 views

### Rolling mean lag function for multiple variables

Thanks to @josliber's help (Rolling mean lag function), I was able to speed up a rolling mean function for different groups and rollmean lengths. Now I'd like to add to this function the ability to ...
32 views

### Statistics Calculator for Listed and Grouped Data

I made a statistics calculator based on raw data for my Edexcel IAL Statistics 1 course which I'm going to use in my calculator's MicroPython. I would like some suggestions for ways to further improve ...
32 views

### Block Bootstrap Estimation in Java - Part 3

This is an extension of Block Bootstrap Estimation in Java - Part 2. The text file text.txt can be found at https://drive.google.com/open?id=1vLBoNmFyh4alDZt1eoJpavuEwWlPZSKX (please download the file ...
65 views

### Manual Regression Tree using Python

I wrote a code to create a regression tree for a synthetic train data of size Np. The idea is, first I have the source node (which consists of all set of points) ...
114 views

### Block Bootstrap Estimation using Java

The data are in a file called test.txt, which is available at https://drive.google.com/file/d/1g0ffvH5oP5C4Cp6ciEp_L1Rst6WeTuYG/view?usp=sharing. There are some odd ...
35 views

### Simulation of Central Limiting Theorem (CLT)

The following is the simulation of Central Limiting Theorem from Statistics: ...
133 views

### Statistics Library with Sample, SampleBuilder and Tests

Introduction I'm working on a Statistics Library that can record observations and produce a Summary of the statistics when there's enough observations. Right now, it's at its early stages and is ...
70 views

### Select array element by its weight/probability

I coded a function that takes an array with numbers and randomly chooses one of these numbers (Returns the index of the chosen one). The value of each number works as an weight which determines the ...
73 views

### Survey Populate with List, Option Label and Formula, VBA

I am quite a novice. The below code does what I require but I was hoping you could help me speeding it up and simplifying it please. I know should start with basics when learning VBA..but it's just so ...
41 views

### Calculate the statistical mean of different files and save it into a CSV file

In this code I calculate the statistical functions of values from different files and save them into CSV files (one filer for each statistical function). ...
81 views

### Linear Regression Class in Python

I have recently been brushing up on my statistics and calculus and wanted to implement Linear Regression, the code will be for a calculus/statistics library I am working on (I know there are libraries ...
389 views

### R function for Dynamic Ordinary Least Squares regression

SHORT VERSION: Made a workflow function, want a better output with methods. General Background I have been working on a package for some time to eliminate the tedium of preliminary time series ...
1k views

### Django Rest Framework Totaling API values in different ways

I am working on a stats website for my softball teams that I manage/play for. Here is my current Stat model: ...
141 views

### Shoe shine shop model in Rust and C++ - Follow-up

I've just refactored my Rust and C++ code which simulates the shoeshine shop model from this question. What else can be improved? C++: ...
2k views

### Shoe shine shop model in Rust

I'm learning Rust and a few questions did arise during translation of my C++ code to Rust. There are comments in Rust code I'd like to be answered. Is there an idiomatic way to solve this task? The ...
57 views

### Select optimal piecewise regression fit

I'm making a program which fits a piecewise linear regression with up to 4-5 breakpoints in the data, and then deciding how many breakpoints is best to prevent over and underfitting. However, my code ...
114 views

### Gamblers ruin, parallel compute trials

Context The following script is a quick implementation of the gambler's ruin problem. For each given upper bound on the number of rounds in a game max_iter, ...
87 views

### Statistics component of Finance Tracker

I'm doing a Java software engineering team project in school and my team has decided on a Finance Tracker application, which contains the main components of Expense, Budget, Statistics, Suggestions ...
38 views

### Using python to estimate the range of unstructured data

I have unstructured input-output data, f=f(x). I want to estimate the range of f as a function of x, given limited sampled. So, I tried to discretize the data use small bins in x to estimate the ...
74 views

### Estimate area of cropped circle with Monte Carlo

I looking around and not finding anything, I developed a simple function for estimating the area of a possibly cropped circle inside a frame. It uses a very basic MC implementation. It is pretty fast ...
78 views

### Fetch, plot, and send security incident statistics with Excel

TLDR: I don't develop for a living. If someone could point me in the right direction to make my script more readable/pythonic I would appreciate the assistance. In particular I'm struggling with the ...
424 views

### Remove outliers from N dimensional data

I have created a function that will remove outliers from a series of data. Generally the data n dimensional. Loosely, an outlier is considered an outlier if it +/- deviates by 1.5 standard_deviation's ...
96 views

### Query to plot a histogram of song ratings

I wrote code to plot a rating distribution, which looks like this: The most important function is the stats function: ...
4k views

### Finding unique pairs in lottery tickets

I was trying to solve one of the hackerrank practice questions. Could anyone please let me know how can I make this code much effective, in terms of time and space complexity? The Super Bowl ...
48 views

### Kernel based conditional increments of many stochastic processes

I have written this function is part of a research project that involves analyzing time-series data from stochastic processes. We have a small number (from 1 to 3) of independent observations of a ...
61 views

### Calculating p-value for Welch's t-test

I am attempting to translate some of my Perl code to Ruby, from http://rosettacode.org/wiki/Welch%27s_t-test I am a very very beginner with Ruby, but I have verified that this is producing the ...
69 views

### A/B testing using chi-square to calculate the significance in an elegant way

The definition of ABtest Goal: For input data, each pair row is a group such as 0 and 1, 2 and 3. I want to test whether each group is significant using chi-square. If result is significant and ...
119 views

### A straightforward method for computing the Binomial probability mass function

I've been writing up code to test an alternate way of calculating the Binomial probability mass function. The Binomial random variable is the number of heads out of N coin tosses with coins that have ...
8k views

### Prettify math formula in code

I have a function to calculate the normal distribution in Python: ...
125 views

### BiasedOptionChooser<T>: a class to do “weighted random choices”

I need to select "random" elements from a collection. Random is quoted because I must assign a weight to each element; elements with higher weights have a greater chance of being selected. To achieve ...
4k views

### Simple Linear Regression in C++

Python has amazing sci-kit learn library but I am building some projects on C++ with involves some machine learning algorithms. I found machine learning libraries in C++ involves more dependencies so ...
120 views

### Calculating difference statistics over a moving window

I'd like to calculate some statistics of given data (frequencies of difference among elements on various distances in percent multiplied by 10) using moving window within that data. Is it possible to ...
3k views

### Markov-chain sentence generator in Python

I wrote a Markov-chain based sentence generator as my first non-trivial Python program. I mainly used C before, so I probably have ignored a lot of Python conventions and features, so any advice would ...
58 views

### Find the median of two sorted arrays [closed]

There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall ...
169 views

### Statistical User-Defined Functions (UDF)

Problem The following statistical functions were created to calculate statistics of experiments: Mean Peak to Peak Standard Deviation Variance Mean Absolute Error (MAE) Mean Square Error (MSE) Root ...
61 views

Student.java ...
94 views

### Generate a large block diagonal covariance matrix with exponential decay

I am implementing Kalman filtering in R. Part of the problem involves generating a really huge error covariance block-diagonal matrix (dim: 18000 rows x 18000 columns = 324,000,000 entries). We denote ...
134 views

### Evaluate joint probability density function of a Markov random field

The following code evaluates probability mass function for all possible states of a model. ...
33 views

### Statistical function which computes the average work time in different months

It's a task from a Ruby-course, in which I'm currently enrolled: Ruby Course - Page Precisely it's one of the assignments for the first week. Following idea: Your are given a list in which finished ...
318 views

### Calculate mean and standard error of a generator in Python

The goal of the following code is to calculate the mean and the standard error of vectors of randomly-generated numbers. I am looking for feedback both on the correctness of the calculation, and on ...
266 views

### Simple Kivy App for Bootstrap Algorithm

I have a very simlpe app built using Kivy, for performing bootstrap algorithm (statistics). We must input some samples in the form x1,x2,...,xn (these will be ...