Prev: for loop imread
Next: Unexplainable Mex Error
From: Jon Smith on 9 Jun 2010 15:58 Does anyone know how to simulate a logit error? Thanks!
From: Tom Lane on 9 Jun 2010 17:48 > Does anyone know how to simulate a logit error? Thanks! Jon, I am not sure this is what you are asking, but here is a script that simulates values from a logistic distribution with location parameter 100 and scale parameter 10, and compares a histogram of the data to the theoretical density. If you're looking for something else, please elaborate. -- Tom z = random('logistic',100,10,[1000,1]); hist(z,5:10:195) area = length(z) * 10; % #points * binwidth x = 0:200; y = area * pdf('logistic',x,100,10); line(x,y,'color','r','linewidth',2)
From: Jon Smith on 10 Jun 2010 09:23 Thanks Tom. That seems to be what I am looking for, but after the first line, Matlab gives me the error "Unrecognized distribution name: 'logistic'." Any thoughts? "Tom Lane" <tlaneATmathworksDOTcom(a)nospam.com> wrote in message <hup27m$lh0$1(a)fred.mathworks.com>... > > Does anyone know how to simulate a logit error? Thanks! > > Jon, I am not sure this is what you are asking, but here is a script that > simulates values from a logistic distribution with location parameter 100 > and scale parameter 10, and compares a histogram of the data to the > theoretical density. > > If you're looking for something else, please elaborate. > > -- Tom > > z = random('logistic',100,10,[1000,1]); > hist(z,5:10:195) > area = length(z) * 10; % #points * binwidth > x = 0:200; > y = area * pdf('logistic',x,100,10); > line(x,y,'color','r','linewidth',2) >
From: Tom Lane on 10 Jun 2010 10:36 > Thanks Tom. That seems to be what I am looking for, but after the first > line, Matlab gives me the error "Unrecognized distribution name: > 'logistic'." Any thoughts? .... >> z = random('logistic',100,10,[1000,1]); Jon, I would expect that to work in relatively recent versions of MATLAB. It turns out the logistic distribution has a very simple form, though. It's easy enough to generate random uniform numbers and invert the cdf. You can replace this line by p = rand(1000,1); z = 100 + 10*log((1-p)./p); -- Tom
|
Pages: 1 Prev: for loop imread Next: Unexplainable Mex Error |