subject
Mathematics, 08.11.2019 01:31 lovelyheart5337

Generation of pseudo-random normal rvs. generate sample size of l rvs,

each iid n(mu, sigma^2) rvs. histogram these with nbins =25; see myhistc. m under files, or use your own. however, read the next section because an overlay is required.

develop a plot where you overlay the normalized histogram (with area 1) with the theoretical pdf. show the goodness of fit is good using a chi-squared test. you should know this from your earlier stats class. take mu=-6, sigma^2 = 2; try different sample sizes of l = 10^2,10^3,10^4.

since these are generated using randn, the fit will be excellent and the chi-squared will be small.

myhistc. m

function [xknt, outknt, xcenter, xdelta] = myhistc(x, nbins, xend);

%function [xknt, outknt, xcenter, xdelta] = myhistc(x, nbins, xend);

% a histogram with nbins within the range [xend(1), xend(2)]

% xend (1: 2), for edges, beyond xend, data is counted in outknt

flagprint = 1; %change to 1 for printing and plotting

x = x(: ); lx = length(x);

outknt = zeros(2,1); xknt = zeros(nbins,1);

lindx=0; indx=find(x < = xend(1)); lindx=length(indx); if(lindx ~= 0); outknt(1)=lindx; end

x(indx)=[];

lindx=0; indx=find(x > xend(2)); lindx=length(indx); if(lindx ~= 0); outknt(2)=lindx; end

x(indx)=[];

xdelta = (xend(2)-xend(1))/nbins; xbin = xend(1) + [0: nbins]*xdelta;

xcenter = zeros(nbins,1);

% loop over the few bins, not over the many data

for ibin=[1: nbins]; % loop over bins, not data

lindx=0; indx=find( (xbin(ibin)< x)& ( x < =xbin(ibin+1)) ); lindx=length(indx);

xcenter(ibin) = mean([xbin(ibin) xbin(ibin+1)]);

if(lindx~=0); xknt(ibin)=lindx; end%%x(indx)=[]; end

%disp([ibin, xbin(ibin) xbin(ibin+1) xcenter(ibin) xknt(ibin)])

end

if(flagprint==1);

format bank

disp([' binid lowedge upedge center count'])

for ibin=[1: nbins]; % loop over bins, not data

disp([ibin, xbin(ibin) xbin(ibin+1) xcenter(ibin) xknt(ibin)])

end

end

format short e

if(flagprint==1);

plot( xcenter, xknt,'r*-'); grid

end

ansver
Answers: 2

Another question on Mathematics

question
Mathematics, 21.06.2019 19:30
The amount spent on food and drink by 20 customers is shown below what is the modal amount spent ?
Answers: 1
question
Mathematics, 22.06.2019 01:20
Anita has a success rate of 80% on free throws in basketball. she wants to know the estimated probability that she can make exactly four of five free throws in her next game. how can she simulate this scenario? categorize each simulation of this scenario as correct or incorrect.
Answers: 2
question
Mathematics, 22.06.2019 04:00
What is the frequency of the sinusoidal graph?
Answers: 1
question
Mathematics, 22.06.2019 05:30
Afootball is passed through the air and caught at ground level for a touchdown. the height of the ball (h) is given by h= -d² + 12d + 6, where d is the distance in feet the ball travels horizontally. how far from the player passing the ball will the ball be caught? 40 points! will mark brainliest!
Answers: 1
You know the right answer?
Generation of pseudo-random normal rvs. generate sample size of l rvs,

each iid n(mu, si...
Questions
question
Mathematics, 27.05.2021 18:00
question
Arts, 27.05.2021 18:00
question
Mathematics, 27.05.2021 18:00
Questions on the website: 13722359