normal-distribution

R superimposing bivariate normal density (ellipses) on scatter plot

徘徊边缘 提交于 2019-12-13 05:49:40
问题 There are similar questions on the website, but I could not find an answer to this seemingly very simple problem. I fit a mixture of two gaussians on the Old Faithful Dataset: if(!require("mixtools")) { install.packages("mixtools"); require("mixtools") } data_f <- faithful plot(data_f$waiting, data_f$eruptions) data_f.k2 = mvnormalmixEM(as.matrix(data_f), k=2, maxit=100, epsilon=0.01) data_f.k2$mu # estimated mean coordinates for the 2 multivariate Gaussians data_f.k2$sigma # estimated

Shapiro Wilk test in objective-c

随声附和 提交于 2019-12-13 03:59:02
问题 I would like to perform a test for normal distribution using the well known Shapiro-Wilk test. I can find many resources with more or less good informations about the test. But I couldn't find any information about implementation the test in c-code. Is there something out there in c or objc dealing with Shapiro-Wilk? Thanks! 来源: https://stackoverflow.com/questions/18676763/shapiro-wilk-test-in-objective-c

Combining two normal random variables

孤街醉人 提交于 2019-12-12 18:36:13
问题 suppose I have the following 2 random variables : X where mean = 6 and stdev = 3.5 Y where mean = -42 and stdev = 5 I would like to create a new random variable Z based on the first two and knowing that : X happens 90% of the time and Y happens 10% of the time. It is easy to calculate the mean for Z : 0.9 * 6 + 0.1 * -42 = 1.2 But is it possible to generate random values for Z in a single function? Of course, I could do something along those lines : if (randIntBetween(1,10) > 1)

Using .Net's StatisticFormula Library

自古美人都是妖i 提交于 2019-12-12 16:07:37
问题 The C# namespace System.Windows.Forms.DataVisualization.Charting.StatisticFormula seems to have a few statistical functions that I need. The namespace is documented at MSDN here. I'd really like to use the InverseNormalDistribution(double Z) function. The problem is that the constructor is internal and so I can't access the functions in anyway that I know. Is there some way to have access to the statics functions in this namespace, or will I have to find other solution? 回答1: You could

Weird behavior of using set.seed multiple times

人走茶凉 提交于 2019-12-12 12:07:50
问题 I came up with a strange result when doing my homework in R, can anyone explain to me what's going on? The instruction told me to set seed 1 to keep consistency. At first, I set seed(1) twice set.seed(1) x <- rnorm(100, mean = 0, sd = 1) set.seed(1) epsilon <- rnorm(100, mean = 0, sd = 0.25) y <- 0.5 * x + epsilon -1 plot(x,y,main = "Scatter plot between X and Y", xlab = "X", ylab = "Y") I get scatter plot like this: The plot with two set seed After I only use one set seed the code is: set

Adding floating point precision to qnorm/pnorm?

ε祈祈猫儿з 提交于 2019-12-12 10:44:33
问题 I would be interested to increase the floating point limit for when calculating qnorm / pnorm from their current level, for example: x <- pnorm(10) # 1 qnorm(x) # Inf qnorm(.9999999999999999444) # The highst limit I've found that still return a <<Inf number Is that (under a reasonable amount of time) possible to do? If so, how? 回答1: If the argument is way in the upper tail, you should be able to get better precision by calculating 1-p. Like this: > x = pnorm(10, lower.tail=F) > qnorm(x, lower

How to extract fitted data from normal probability density function

耗尽温柔 提交于 2019-12-11 21:58:56
问题 If I fit a uni-variate data with normal distribution, how can i get back the fitted values in MATLAB. I am using this simple example load hospital % data x = hospital.Weight; [mu sigma]=normfit(x) %normal fitting %To visualize the pdf xval=min(x):0.1:max(x) yval=normpdf(xval,mu,sigma) plot(xval,yval) yval is giving the probabilities of xval values. Now, If I would like to extract the fitted values of 'x' after approximating it with the above normal distribution, how do I do that?. As can be

Generating a normally distributed list of random integers between two values in Excel

半城伤御伤魂 提交于 2019-12-11 16:28:43
问题 I need to generate a list of random integer values between a lower and an upper limit for a normal distribution using a given mean. For example: a bell distribution of 150 random values between 1 and 10, with a mean of 3. The mean can be approximated (e.g. a float between 2.8 and 3.2) but the numbers of the list need to be integers. This thread seems to point to possible directions. With NORM.INV(RAND(),mean,dev) I can generate floats and then transform them to integers, but I don't know how

Approximating Normal Distribution by adding Random Numbers

喜欢而已 提交于 2019-12-11 16:11:52
问题 I would like to generate some random numbers which are normally distributed. It’s not mission critical, so a simple algorithm will suffice. I would then like to supply my own mean and standard deviation. From what I have been able to read, according to the Central Limit Theorem, I should be able to approximate normally distributed random numbers by adding random numbers together. For example: rand()+rand()+rand()+rand()+rand()+rand() where rand() results in an evenly distributed random number

Normal distribution shapes: symmetric or skewed

情到浓时终转凉″ 提交于 2019-12-11 14:26:34
问题 I'm having hard time differentiating between shapes: Symmetric & Skewed There are some clear graphs. You don't need to think twice But here for example: The histogram makes me really confused Is it a right skewed? is it symmetric? Totally lost. :( I have tried many ways to get the right answers: comparing between mean=26.75 and median=25.5 values calculating the following distances: From min to the median is (less/equal or greater) than the one from median to the max. From the min value to Q1