Prussian Excel File: http://www.mediafire.com/file/5elj8i23ad1easn/prussian.csv
ID: 3577844 • Letter: P
Question
Prussian Excel File: http://www.mediafire.com/file/5elj8i23ad1easn/prussian.csv
Please help me with this. Help by writing the script in r. Thank you.
Read data from prussian.csv. The y column of the data is the number of death from horse kicks at a particular year at a particular army corp. Disr the year and corp column and regard consider the entire y column as your data. We shall try to fit the y column as data from Poisson(A) for some A 0. We have to estimate this A. Since we know that if Y N Poisson(A) then E(Y) A. Thus calculate sample mean of Y from the data and put A equal to this. Now observe that in our data set Y takes only the values 0,1,2,3,4. Calculate the observed probabilities P(Y 0), P(Y 1), POY 2), POY 3), POY 4) by equating them to the relative frequencies. Now calculate the estimated probabilities POY 0), POY 1), P(Y 2). POY 3), P(Y 4) for Y n Poisson(A). We want to compare the observed with the estimated probabilities. To do this, you have to draw a grouped bar graph where for each i 0.1 place two bars one orange for observed P(Y i)Explanation / Answer
fid = fopen('prusssian.csv');
out = textscan(fid,'%d%fd%d%s','delimiter',',');
fclose(fid);
x = out{2};
y = poisspdf(x,5); %considering lambda value as 5
plot(x,y,'+') % plotting the PDF poission distribution
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.