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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
42 views

Java - Select the maximum integers from sliding windows over an array

So I have the following algorithm. Given an array A[0 ... n - 1] and the window length w, compute all the windows ...
user avatar
  • 25.6k
0 votes
1 answer
41 views

Identify IRC users with largest vocabulary ignoring links and short words

I wrote this script to figure out which users have the largest vocabulary on my irc server. I would like to see if there's any way to clarify what I consider a very quick script. It outputs a CSV ...
user avatar
  • 875
0 votes
0 answers
23 views

Plot ellipse hypothesis plots with confidence intervals for multiple models

I have developed a function to graphically plot between two predictors of interest their confidence interval regions on an ellipse. It states whether the null hypotheses have been accepted for the one-...
user avatar
9 votes
3 answers
549 views

Computing a simple moving average on an array in C++

I have just started to learn C++ and wanted to improve my function. I am making a basic statistical API and am calculating an SMA (simple moving average) for some data. This function provides the ...
user avatar
  • 191
7 votes
7 answers
1k views

A probability distribution function, to be called repeatedly during numerical integration

I am trying to speed up as much a possible this function in C++. As I explained in another post, Implementing multidimensional integral for a custom function in C++, this function will be used inside ...
user avatar
2 votes
1 answer
503 views

Most frequent element in an array, return lowest if multiple

I have been learning C++ for the past 2 weeks. Following is a problem I solved from Hackerrank. I am somewhat unsure if it's the correct way to solve this, even though I got the desired output. How ...
user avatar
  • 89
1 vote
1 answer
52 views

Exponentially-weighted moving mean and standard deviation of an irregularly-spaced weighted time series

The following numpy/python function computes exponentially-weighted moving mean and standard deviation of an irregularly-spaced weighted time series. I want to make it faster by getting rid of the ...
user avatar
1 vote
1 answer
75 views

Implementation of a beta-binomial test in Python

I have been unable to find a Python function for performing beta-binomial test. There is, however, a binomial test function in the scipy.stats.binomtest and I have ...
user avatar
  • 227
5 votes
1 answer
155 views

Monte-carlo simulation code - simple exercise

I created a quick monte-carlo simulation which seems to do what I want (simple version below). The code basically simulates a Poisson distribution, say this results in a simulation of ...
user avatar
  • 53
1 vote
0 answers
25 views

Statistical bootstrapping in Python - is my code correct?

I wonder if my code for bootstrapping in Python is correctly coded or if there are logical flaws in it. It uses a 95% confidence interval. The code basically does the following for two datasets that ...
user avatar
  • 11
0 votes
1 answer
33 views

Obtaining statistics from each batch

I fully admit that the code below is long and ugly. What's happening is that in the validation section of this machine learning model (used for text recognition), I would like to obtain the character ...
user avatar
  • 1
2 votes
0 answers
57 views

Mean, median and mode GUI

This program takes x numbers and displays the mean, median and mode. My goal here was to use classes and class properties the best i could to make the code shorter (honestly i may have just made it ...
user avatar
  • 93
4 votes
1 answer
119 views

Function to calculate the GC content variation in a sequence

I came across this BMC Genomics paper: Analysis of intra-genomic GC content homogeneity within prokaryotes And I implemented some Python functions to make this available as part of a personal project. ...
user avatar
3 votes
0 answers
68 views

Python program that analyzes a corpus for randomword generation

I play a lot of old-school western CRPGs, and most of them (if not all) require the player to generate an avatar at the start of a new game, including naming the character (with names that will never ...
user avatar
0 votes
0 answers
83 views

How to do kendalls tau in O(n log n)? O(n^2) is shown

I am trying write a method that will calculate kendalls tau in O(n log n) time. I have a managed to it in O(n^2) quite easily however I cannot find any GOOD explanation online that will describe with ...
user avatar
6 votes
5 answers
686 views

Mean and Variance for Math Library

Taking forward the code written for the math library I'm developing. I wrote templatized functions for mean and variance. std::accumulate() (or summation in ...
user avatar
1 vote
2 answers
388 views

Java simple stats program

This is a simple Java program I made that takes in any number, and when it gets to 0, it returns the quantity of the numbers, the min, max, sum, and average of the numbers. Are there any ways how I ...
user avatar
1 vote
0 answers
32 views

Python 3 script for statistiscal analysis of English vocabulary

This is a Python 3 script that statistically analyzes 105,230 words with a total of 913,935 characters, its results will be used for pseudoword generation purposes. You will need this file for it to ...
user avatar
5 votes
1 answer
179 views

Linear Regression in Haskell

After quite some time away from Haskell I am trying to brush up. To do so I am writing some basic linear regression functionality. The code produces the output expected. In essence I am trying to ...
user avatar
1 vote
1 answer
905 views

T-test Independence for a Pandas DataFrame

I want to calculate the scipy.stats.ttest_ind() for numeric columns in a pandas DataFrame with the binary target variable. ...
user avatar
3 votes
0 answers
53 views

Sampling distribution of the sample mean

This program generates the entire sample distribution of the sample mean. The parent population has elements that have N distinct values. Samples of size n are drawn, with replacement. When N and n ...
user avatar
  • 31
1 vote
0 answers
98 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 ...
user avatar
4 votes
1 answer
163 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 ...
user avatar
  • 43
6 votes
1 answer
315 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 ...
user avatar
1 vote
0 answers
168 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: ...
user avatar
  • 41
3 votes
1 answer
182 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 ...
user avatar
  • 1,180
1 vote
0 answers
35 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 ...
user avatar
4 votes
2 answers
121 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 ...
user avatar
1 vote
1 answer
39 views

Simulation of Central Limiting Theorem (CLT)

The following is the simulation of Central Limiting Theorem from Statistics: ...
user avatar
4 votes
4 answers
142 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 ...
user avatar
5 votes
1 answer
708 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 ...
user avatar
6 votes
1 answer
78 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 ...
user avatar
0 votes
1 answer
94 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). ...
user avatar
  • 3
3 votes
3 answers
188 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 ...
user avatar
9 votes
2 answers
159 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 ...
user avatar
5 votes
1 answer
149 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++: ...
user avatar
  • 403
17 votes
3 answers
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 ...
user avatar
  • 403
5 votes
1 answer
145 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, ...
user avatar
3 votes
1 answer
99 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 ...
user avatar
2 votes
0 answers
44 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 ...
user avatar
4 votes
0 answers
79 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 ...
user avatar
  • 565
5 votes
1 answer
83 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 ...
user avatar
  • 161
1 vote
1 answer
1k 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 ...
user avatar
  • 201
4 votes
2 answers
115 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: ...
user avatar
  • 243
2 votes
2 answers
117 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 ...
user avatar
  • 217
5 votes
2 answers
89 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 ...
user avatar
  • 161
3 votes
2 answers
141 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 ...
user avatar
  • 751
1 vote
2 answers
7k 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 ...
user avatar
15 votes
5 answers
4k 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 ...
user avatar
  • 211
1 vote
0 answers
67 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 ...
user avatar
  • 129

1
2 3 4 5
8