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 15:00
Prove that 3: 8 is equivalent to 12: 32.a. use diagrams to support your answer.
Answers: 1
question
Mathematics, 21.06.2019 17:40
Long division the problem is 40 ➗ 348 = ?
Answers: 1
question
Mathematics, 21.06.2019 19:00
Me asap on # : explain how factoring a trinomial, ax^2+ bx+ c, when a does not equal 1 different from factoring a trinomial when a = 1.
Answers: 2
question
Mathematics, 21.06.2019 20:30
Martha has a deck of cards. she has lost some of the cards, and now the deck only contains nine spades, eleven diamonds, eight clubs, and twelve hearts. martha predicts that whenever she draws a card from the deck without looking, she will draw a club one-fifth of the time. which activity would best allow martha to test her prediction? a. randomly draw a card from the box and see if it is a club. b. randomly draw a card. then, continue to draw another card until all eight clubs are drawn. c. randomly draw and replace a card 120 times. then, observe how close to 30 times a club is drawn. d. randomly draw and replace a card 100 times. then, observe how close to 20 times a club is drawn.
Answers: 3
You know the right answer?
Generation of pseudo-random normal rvs. generate sample size of l rvs,

each iid n(mu, si...
Questions
Questions on the website: 13722361