Why am I getting “algorithm did not converge” and “fitted prob numerically 0 or 1” warnings with glm?

If you look at ?glm (or even do a Google search for your second warning message) you may stumble across this from the documentation: For the background to warning messages about ‘fitted probabilities numerically 0 or 1 occurred’ for binomial GLMs, see Venables & Ripley (2002, pp. 197–8). Now, not everyone has that book. But … Read more

Calculating Pearson correlation and significance in Python

You can have a look at scipy.stats: from pydoc import help from scipy.stats.stats import pearsonr help(pearsonr) >>> Help on function pearsonr in module scipy.stats.stats: pearsonr(x, y) Calculates a Pearson correlation coefficient and the p-value for testing non-correlation. The Pearson correlation coefficient measures the linear relationship between two datasets. Strictly speaking, Pearson’s correlation requires that each … Read more

Cosmic Rays: what is the probability they will affect a program?

From Wikipedia: Studies by IBM in the 1990s suggest that computers typically experience about one cosmic-ray-induced error per 256 megabytes of RAM per month.[15] This means a probability of 3.7 × 10-9 per byte per month, or 1.4 × 10-15 per byte per second. If your program runs for 1 minute and occupies 20 MB … Read more

Find p-value (significance) in scikit-learn LinearRegression

This is kind of overkill but let’s give it a go. First lets use statsmodel to find out what the p-values should be import pandas as pd import numpy as np from sklearn import datasets, linear_model from sklearn.linear_model import LinearRegression import statsmodels.api as sm from scipy import stats diabetes = datasets.load_diabetes() X = diabetes.data y … Read more