Skip to content
Advertisement

Tag: distribution

Simulating expectation of continuous random variable

Currently I want to generate some samples to get expectation & variance of it. Given the probability density function: f(x) = {2x, 0 <= x <= 1; 0 otherwise} I already found that E(X) = 2/3, Var(X) = 1/18, my detail solution is from here https://math.stackexchange.com/questions/4430163/simulating-expectation-of-continuous-random-variable But here is what I have when simulating using python: What am I doing

Create a matrix with np.random.normal

I need to create an nxn matrix in which the numbers in the cells are distributed following a Gaussian distribution. This code may not go well because it fills a cell with a sequence. how can I do? Answer Edited for border of zeros np.random.normal takes a size keyword argument. You can use it like this:

student t confidence interval in python

I am interested in using python to compute a confidence interval from a student t. I am using the StudentTCI() function in Mathematica and now need to code the same function in python http://reference.wolfram.com/mathematica/HypothesisTesting/ref/StudentTCI.html I am not quite sure how to build this function myself, but before I embark on that, is this function in python somewhere? Like numpy? (I

Advertisement