normal-distribution

Set y axis limits matlab plot

可紊 提交于 2019-12-19 11:39:16
问题 I have the following normal distribution and i need to set the graph plot to 1.5 on y axis. x = -.5:0.0001:3.5; m1 = 1; s1 = 0.5; pdfNormal_1 = normpdf(x, m1, s1); ylim([0 1.5]) set(gcf,'color','w'); plot(x, pdfNormal_1)%, x, pdfNormal_2); Could someone tell me how to? Regards 回答1: The axis function is the one you need. you can set the axis to the values you want using axis([xmin xmax ymin ymax]) or you can play with it doing things like: axis equal axis tight axis off etc Go to the

Calling rnorm with a vector of means

若如初见. 提交于 2019-12-18 12:59:10
问题 When I call rnorm passing a single value as mean, it's obvious what happens: a value is generated from Normal(10,1). y <- rnorm(20, mean=10, sd=1) But, I see examples of a whole vector being passed to rnorm (or rcauchy , etc..); in this case, I am not sure what the R machinery really does. For example: a = c(10,22,33,44,5,10,30,22,100,45,97) y <- rnorm(a, mean=a, sd=1) Any ideas? 回答1: The number of random numbers rnorm generates equals the length of a. From ?rnorm : n: number of observations.

Generating random correlated x and y points using Numpy

扶醉桌前 提交于 2019-12-18 11:53:52
问题 I'd like to generate correlated arrays of x and y coordinates, in order to test various matplotlib plotting approaches, but I'm failing somewhere, because I can't get numpy.random.multivariate_normal to give me the samples I want. Ideally, I want my x values between -0.51, and 51.2, and my y values between 0.33 and 51.6 (though I suppose equal ranges would be OK, since I can constrain the plot afterwards), but I'm not sure what mean (0, 0?) and covariance values I should be using to get these

How to generate normally distributed random from an integer range?

雨燕双飞 提交于 2019-12-18 11:13:11
问题 Given the start and the end of an integer range, how do I calculate a normally distributed random integer between this range? I realize that the normal distribution goes into -+ infinity. I guess the tails can be cutoff, so when a random gets computed outside the range, recompute. This elevates the probability of integers in the range, but as long as the this effect is tolerable (<5%), it's fine. public class Gaussian { private static bool uselast = true; private static double next_gaussian =

Why does scipy.norm.pdf sometimes give PDF > 1? How to correct it?

≯℡__Kan透↙ 提交于 2019-12-17 19:28:08
问题 Given mean and variance of a Gaussian (normal) random variable, I would like to compute its probability density function (PDF). I referred this post: Calculate probability in normal distribution given mean, std in Python, Also the scipy docs: scipy.stats.norm But when I plot a PDF of a curve, the probability exceeds 1! Refer to this minimum working example: import numpy as np import scipy.stats as stats x = np.linspace(0.3, 1.75, 1000) plt.plot(x, stats.norm.pdf(x, 1.075, 0.2)) plt.show()

Gaussian Mixture Model in MATLAB - Calculation of the Empirical Variance Covariance Matrix

爱⌒轻易说出口 提交于 2019-12-14 04:04:56
问题 I am having issues in reconciling some basic theoretical results on Gaussian mixtures and the output of the commands gmdistribution, random in Matlab. Consider a mixture of two independent 3-variate normal distributions with weights 1/2,1/2 . The first distribution A is characterised by mean and variance-covariance matrix equal to muA=[-1.4 3.2 -1.9]; %mean vector rhoA=-0.5; %correlation among components in A sigmaA=[1 rhoA rhoA; rhoA 1 rhoA; rhoA rhoA 1]; %variance-covariance matrix of A The

Writing a proper normal log-likelihood in R

落爺英雄遲暮 提交于 2019-12-13 20:27:38
问题 I have a problem regarding the following model, where I want to make inference on μ and tau, u is a known vector and x is the data vector. The log-likelihood is I have a problem writing a log-likelihood in R. x <- c(3.3569,1.9247,3.6156,1.8446,2.2196,6.8194,2.0820,4.1293,0.3609,2.6197) mu <- seq(0,10,length=1000) normal.lik1<-function(theta,x){ u <- c(1,3,0.5,0.2,2,1.7,0.4,1.2,1.1,0.7) mu<-theta[1] tau<-theta[2] n<-length(x) logl <- sapply(c(mu,tau),function(mu,tau){logl<- -0.5*n*log(2*pi) -0

generate normal distributed timestamps within a range [0,x]

依然范特西╮ 提交于 2019-12-13 18:18:15
问题 I want to generate a file containing timestamps (integers between 0 and a bound value x, in increasing order) which represents arrivals of an event. The "Event arrival rate" should be "normal distributed" which means, somehow in the "middle" of the dataset the rate of arrivals should be more frequently as at the beginning and the end. How can i generate such a list of values using java? regards 回答1: I agree with greedybuddha that a Gaussian function is what you want here, but you also stated

Is it important for a neural network to have normally distributed data?

妖精的绣舞 提交于 2019-12-13 17:09:05
问题 So one of the standard things to do with the data is normalize it and standardize it to have data that's normally distributed with a mean 0 and standard deviation of 1, right? But, what if the data is NOT normally distributed? Also, does the desired output has to be normally distributed too? What if I want my feedforward net to classify between two classes (-1, and 1), that would be impossible to standardize into a normal distribution of mean 0 and std of 1 right? Feedforward nets are non

Generating normal distribution in order python, numpy

江枫思渺然 提交于 2019-12-13 08:35:48
问题 I am able to generate random samples of normal distribution in numpy like this. >>> mu, sigma = 0, 0.1 # mean and standard deviation >>> s = np.random.normal(mu, sigma, 1000) But they are in random order, obviously. How can I generate numbers in order, that is, values should rise and fall like in a normal distribution. In other words, I want to create a curve (gaussian) with mu and sigma and n number of points which I can input. How to do this? 回答1: To (1) generate a random sample of x