normal-distribution

Defining a function that calculates the covariance-matrix of a correlation-matrix

允我心安 提交于 2019-12-03 16:38:48
I have some problems with the transformation of a matrix and the names of the rows and columns. My problem is as follows: As input-matrix I have a (symmetric) correlation matrix like this one: The correlation-vector is given by the values of the lower triangular matrix: Now, I want to compute the variance-covariance-matrix of the these correlations, which are approximately normally distributed with the variance-covariance-matrix : The variances can be approximated by -> N is the sample size (in this example N = 66) The covariances can be approximated by For example the covariance between r_02

normality test of a distribution in python

孤者浪人 提交于 2019-12-03 05:54:17
I have some data I have sampled from a radar satellite image and wanted to perform some statistical tests on. Before this I wanted to conduct a normality test so I could be sure my data was normally distributed. My data appears to be normally distributed but when I perform the test Im getting a Pvalue of 0, suggesting my data is not normally distributed. I have attached my code along with the output and a histogram of the distribution (Im relatively new to python so apologies if my code is clunky in any way). Can anyone tell me if Im doing something wrong - I find it hard to believe from my

Code to generate Gaussian (normally distributed) random numbers in Ruby

余生颓废 提交于 2019-12-03 04:48:23
问题 What is some code to generate normally distributed random numbers in ruby? (Note: I answered my own question, but I'll wait a few days before accepting to see if anyone has a better answer.) EDIT: Searching for this, I looked at all pages on SO resulting from the two searches: +"normal distribution" ruby and +gaussian +random ruby 回答1: Python's random.gauss() and Boost's normal_distribution both use the Box-Muller transform, so that should be good enough for Ruby too. def gaussian(mean,

when generating normally-distributed random values, what is the most efficient way to define the range?

爷,独闯天下 提交于 2019-12-03 03:55:01
FYI: random == pseudo-random A. when generating uniformly-random numbers, I can specify a range, i.e.: (Math.random()-Math.random())*10+5 //generates numbers between -5 and 15 B. generating a set of random values with a version of Gaussian-esque normal randomness: //pass in the mean and standard deviation function randomNorm(mean, stdev) { return Math.round((Math.random()*2-1)+(Math.random()*2-1)+(Math.random()*2-1))*stdev+mean); } //using the following values: { mean:400, standard_deviation:1 //results in a range of 397-403, or +-range of 3 }, { mean:400, standard_deviation:10 //results in a

R - Plotting two bivariate normals in 3d and their contours respectively

隐身守侯 提交于 2019-12-02 22:52:42
I have been playing around with the MASS package and can plot the two bivariate normal simply using image and par(new=TRUE) for example: # lets first simulate a bivariate normal sample library(MASS) bivn <- mvrnorm(1000, mu = c(0, 0), Sigma = matrix(c(1, .5, .5, 1), 2)) bivn2 <- mvrnorm(1000, mu = c(0, 0), Sigma = matrix(c(1.5, 1.5, 1.5, 1.5), 2)) # now we do a kernel density estimate bivn.kde <- kde2d(bivn[,1], bivn[,2], n = 50) bivn.kde2 <- kde2d(bivn2[,1], bivn[,2], n = 50) # fancy perspective persp(bivn.kde, phi = 45, theta = 30, shade = .1, border = NA) par(new=TRUE) persp(bivn.kde2, phi

Separate mixture of gaussians in Python

五迷三道 提交于 2019-12-02 17:20:00
There is a result of some physical experiment, which can be represented as a histogram [i, amount_of(i)] . I suppose that result can be estimated by a mixture of 4 - 6 Gaussian functions. Is there a package in Python which takes a histogram as an input and returns the mean and variance of each Gaussian distribution in the mixture distribution? Original data, for example: This is a mixture of gaussians , and can be estimated using an expectation maximization approach (basically, it finds the centers and means of the distribution at the same time as it is estimating how they are mixed together).

Random number within a range based on a normal distribution

丶灬走出姿态 提交于 2019-12-02 16:13:51
I want to generate random numbers with a range (n to m, eg 100 to 150), but instead of purely random I want the results to be based on the normal distribution. By this I mean that in general I want the numbers "clustered" around 125. I've found this random number package that seems to have a lot of what I need: http://codeproject.com/KB/recipes/Random.aspx It supports a variety of random generators (include mersiene twister) and can apply the generator to a distribution. But I'm confused, if I use a normal distribution generator the random numbers are from roughly -6 to +8 (apparently the true

manipulate data to better fit a Gaussian Distribution

旧街凉风 提交于 2019-12-01 17:59:13
问题 I have got a question concerning normal distribution (with mu = 0 and sigma = 1 ). Let say that I firstly call randn or normrnd this way x = normrnd(0,1,[4096,1]); % x = randn(4096,1) Now, to assess how good x values fit the normal distribution, I call [a,b] = normfit(x); and to have a graphical support histfit(x) Now come to the core of the question: if I am not satisfied enough on how x fits the given normal distribution, how can I optimize x in order to better fit the expected normal

How to generate numbers with a normal distribution in SQL Server

落爺英雄遲暮 提交于 2019-12-01 17:38:45
I'm trying to seed some data, is there anyway to generate numbers in SQL Server that follow a normal distribution curve? Like: I will specify the mean, the standard deviation and the count and I get a list of numbers back? quoting from http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=135026 you might try with CREATE FUNCTION [dbo].[udf_NORMSDIST] ( @x FLOAT ) RETURNS FLOAT AS /**************************************************************************************** NAME: udf_NORMSDIST WRITTEN BY: rajdaksha http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=135026 DATE: 2009/10/29 PURPOSE: Mimics

How to generate numbers with a normal distribution in SQL Server

点点圈 提交于 2019-12-01 15:58:07
问题 I'm trying to seed some data, is there anyway to generate numbers in SQL Server that follow a normal distribution curve? Like: I will specify the mean, the standard deviation and the count and I get a list of numbers back? 回答1: quoting from http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=135026 you might try with CREATE FUNCTION [dbo].[udf_NORMSDIST] ( @x FLOAT ) RETURNS FLOAT AS /**************************************************************************************** NAME: udf_NORMSDIST