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
3
votes
1answer
70 views

Evaluating association strengths of items

I have a list of animals with their counts: ...
3
votes
3answers
361 views

Eloquent Javascript exercise: find average age from ancestors array per century

I solved an exercise from the book "Eloquent Javascript". I want to share with you guys the solution. The exercise is from chapter 5. Summing up, I have to find the average age from the ancestors ...
3
votes
1answer
8k views

Create quantile slices from dataframe columns

I have the following, working code: ...
3
votes
2answers
484 views

IMAP Mailbox Daily Average Volume Statistics Generator

Because my job needed something like this, I created a Python script that'll connect to an IMAP server, get all the emails, and then calculate the very rough daily average of emails received to the ...
3
votes
2answers
843 views

Checking literary works for Zipf's Law

I wrote a Python script that, given a literary work in text file format, takes it apart, makes a word list, counts how many times each words appears in the literary work, and then checks if it follows ...
3
votes
1answer
730 views

Arithmetic quiz with class database and score analysis

I have done this quiz project and I have tried as hard as I could when I was writing to make it user friendly to read. Could you help me on improving and making it more user friendly please. ...
3
votes
1answer
3k views

Basic Java statistics class

I noticed there's some code on StackOverflow that is, to put it mildly, suboptimal. I'm posting here to see if we can provide a better solution. Here's a proposal for fixing it. The approach is to ...
3
votes
1answer
82 views

Optimization for calculating statistics

I have collected a large amount of data about the train network in my country. Now, I am writing some code that calculates the average amount of delay on the entire train network, for each day, in a ...
3
votes
1answer
4k views

Help improve my my python code for Exponential Smoothing Sumitted to Statsmodel

I just submitted this pull request to statsmodels (a Python toolkit for statistical and econometric modeling). It adds support for exponential smoothing of time ...
3
votes
1answer
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 ...
3
votes
1answer
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 ...
3
votes
1answer
375 views

Groovy script to get average price per group from different data arrays

I've been trying to learn Groovy lately and I tried to solve a problem which involves designing a routine that will calculate the average Product price per Group. I have the following data: ...
3
votes
1answer
233 views

Program which accepts grades and prints grade distribution

I'm doing the MOOC Java course (CTRL+F "distribution"): The input of the program is a set of exam scores of a course. Each score is an integer. When -1 is entered, the program stops asking for ...
3
votes
1answer
70 views

Statistics and calculations

I went through a series of lessons in data science using pandas and numpy. I have attempted to replicate some of the more common algorithms based on maths forumlas and psuedocode, except for the <...
3
votes
3answers
3k 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 ...
3
votes
1answer
553 views

R - Outlier Detection Algorithm

I am trying to implement an algorithm for detecting outliers in R and I am pretty new to the language. The outlier algorithm is described in this paper in detail on page 10-11, but to summarize it ...
3
votes
1answer
439 views

Monte Carlo Simulation of P-Value

I'm testing Python 3 code to perform a Monte Carlo simulation based on the result of an statistical test. I currently have the result of the statistical test in a pandas dataframe, like this. ...
3
votes
1answer
1k views

Normalizing data over a distribution

I have a list X containg the data performed by different users N so the the number of the ...
3
votes
1answer
51 views

Determine column averages

I'm trying to write terse Perl code to calculate the average of each column in a file. The file can have >= 1 columns. ...
3
votes
2answers
543 views

Specialized version of the cross correlation function

I am writing a specialized version of the cross correlation function as used in neuroscience. The function below is supposed to take a time series data and ask how ...
3
votes
0answers
187 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 ...
3
votes
0answers
37 views

TensorFlow regressor to predict probability of winning, given a current score

This is a TensorFlow regressor that tells me that if you get x score, you will have x% to win a game in x game(game is not important). Doing this as a project to learn tensorflow. ...
3
votes
0answers
51 views

'Weighted sample' from overlapping categories

I wish to write a function, that will sample from various (potentially overlapping) categories \$C_1, C_2, \ldots C_k\$, such that the sampled values are in the ratio \$r_1:r_2:\ldots: r_k\$ or as ...
3
votes
0answers
370 views

PCA, LDA and Logistic Regression

Based on the great blog by Joel Grus, I implemented LogisticRegression, PCA, and LDA. I'd appreciate feedback as I'm not sure that the logistic classifier is good enough (as it supposed to achieve ...
3
votes
0answers
2k views

A Simple K-Means Cluster Analyzer v0.1

[NOTE] This question can be depreciated in favor of version 0.2. This code works well. This my first attempt at creating a robust, computationally lean K-Means Cluster analyzer. I first saw this ...
3
votes
0answers
1k views

KS-Statistic in C++

Consider the MCG with parameters: a = 23, M = 10^8 + 1, and let the seed be 47594118. (This is the original MCG proposed by Lehmer in 1948.) Apply the Kolmogorov-Smirnov test to the first 1000 random ...
3
votes
0answers
241 views

Naive implementation of Naive Bayes in Haskell

A simple implementation of Naive Bayes, as I'm a Haskell beginner I've tried to put an emphasis on clarity and documentation. I've tried to incorporate the feedback from a similar question. This is ...
3
votes
0answers
141 views

Read in file, Filter out records, output results

I have been working on a project for some time and have let one Python file grow into a huge file that tries to do everything. The structure is pretty flat and I don't like it. I've used other ...
3
votes
0answers
167 views

Nonlinear Nonparametric Regression

I explain the nonlinear correlation coefficients in this paper and provided the code in this post. The nonlinear nonparametric regression is an extension of this work and its description can be found ...
3
votes
0answers
129 views

Correlation and Dependence

It is well known that 0 dependence implies 0 correlation, while 0 correlation does not imply 0 dependence. I have a paper here illustrating nonlinear correlation coefficients from relationship subsets ...
3
votes
0answers
151 views

Computing pairwise distance covariances for a symmetric matrix

I wrote a non-vectorized, non-parallel wrapper function for computing the pairwise distance covariances (Wikipedia) (original paper) in a data frame: ...
2
votes
4answers
149 views

Calculate min, max, mean and median out of array Version 2

This question is a follow up of: Calculate min, max, mean and median out of array I took all the suggestions an reworked the code. Like the description of the excercise suggests i only use one ...
2
votes
3answers
211 views

Printing a table of letter frequencies using Python

What is the recommended (standard, cleaner, more elegant, etc.) method in Python to get a string with all the alphabet letters? Here's three versions of code to generate a dictionary with keys as ...
2
votes
3answers
185 views

Statistical methods using PHP (mean, co/variance, standard deviation, skew, correlation)

Functionality This class has a list of statistical functions such as mean, variance, standard deviation, skewness, and it works okay. These functions are applied to arrays of charts data. It is an ...
2
votes
2answers
231 views

Given a list of words, find the most common initial character and other statistics

20 different words are inputted using a string array. A C++ program to display the alphabet which has occurred the maximum number of times as starting letter of a word in the list,and how many times ...
2
votes
2answers
898 views

Extracting price statistics from a CSV file

I got the following task to solve: ...
2
votes
2answers
873 views

Row-wise mean imputation in R

Someone on SO asked how to fill in the NA's with row means. His example code was: ...
2
votes
1answer
128 views

Rolling mean lag function

I'm working in base R here, but would like to convert these functions to something more efficient in R (e.g. speed up processing with dplyr). This takes a while ...
2
votes
1answer
77 views

Mean of integers, ignoring the largest and smallest values

The code returns the mean of a list of integers, except ignoring the largest and smallest values in the list. If there are multiple copies of the smallest value, ignore just one copy, and likewise for ...
2
votes
1answer
4k views

Finding the percentile corresponding to a threshold

I need to find which percentile of a group of numbers is over a threshold value. Is there a way that this can be speed up? My implementation is much too slow for the intended application. In case this ...
2
votes
2answers
562 views

Binning and calculating a huge range of data

I have a code that I'm fairly certain does what I want. Bear with me as I explain what I'm doing: Imagine that there is 10 houses, where there can be one to an infinite number of persons. Each of ...
2
votes
2answers
54 views

The importance of consistency in percentage returns when investing

It is said that Being consistent in percentage annual returns leads to larger amount over time. That is for any given principal, getting 20% successively for 2 years is better than 30% for first ...
2
votes
1answer
47 views

Basic Single Header statistics and ml libray for C++ - Scikit-Learn like implementation

I am developing scikit-learn like implementation for C++ it is in the initial stage while developing I've started doubt myself that is this the correct implementation, since here accuracy is more ...
2
votes
2answers
215 views

Estimating the total production count from a few random serial numbers

This is basically my attempt to the German Tank Problem in which we are given a few serial numbers and expected to return an estimation of the total production count. Such as, if 4 tanks are captured ...
2
votes
2answers
292 views

Top K frequent elements

I am working on an interview question where I need to return the k most frequent elements given a non-empty array of integers. Input: nums = [1,1,1,2,2,3], k = 2 Output: [1,2] Here is my code: <...
2
votes
3answers
93 views

Speed up weighted average for Leela Chess Zero

Problem: Given a vector of about 40 values m with normal error sd compute the weighted average of the values weighted by the ...
2
votes
2answers
109 views

A bag of numbers in C++ for constant time statistics queries

(See the next iteration.) I have this simple "data structure" for storing numbers and querying the statistics on them (average, variance and standard deviation): numberbag.hpp ...
2
votes
1answer
312 views

Multiple files data processing in Clojure

I have made a small script which grabs data into a map from 80 CSV files and calculates some statistics like average, standard deviation etc. It's also adding some additional data to map from filename....
2
votes
1answer
1k views

Calculating exponential moving averages with multiples threads

I calculate the moving averages of a specific measure. However, multiples threads can access this class in order to compute the average. ...
2
votes
2answers
489 views

Calculating the statistical Mode(s) of a (possibly multi-modal) set of elements

I am trying to come up with the most performant way of calculating the statistical Modes of a std::vector, obeying two conditions: 1) my function should not ...

1
4
5
6 7 8