matlab - calculating x2 from poisson distributed data -
so have table of values
v=0 1 2 3 4 5 6 7 8 9 #times obs.: 5 19 23 21 14 12 3 2 1 0
i supposed calculate chi squared assuming info fits poisson dist. mean u=3. have grouping values >=6 in 1 bin.
i unsure of how plot poisson dist., , of how command goes bin, if makes sense.
i have plotted histogram using histc before..but random numbers normalized. amount in each bin set me. super new...sorry if question sucks.
you utilize bar
plot bar graph in matlab.
so do:
v=0:9; f=[5 19 23 21 14 12 3 2 1 0]; fc=f(find(v<6)); % re-create elements v<=6 new array fc(end+1)=sum(f(v=>6)); % append sum of elements v=>6 array figure bar(v(v<=6), fc);
that should trick...
now didn't inquire chi squared calculation. urge not set values of v>6 1 bin calculation, give bad result.
there technique: if utilize hist
function, can take bins - , matlab automatically set things exceed limits lastly bin. if observations in array obs
, can asked with:
h = hist(obs, 0:6); figure bar(0:6, h)
the advantage have array h
available (frequencies) other calculations.
if instead
hist(obs, 0:6)
matlab plot graph in single statement (but don't have values...)
matlab statistics
No comments:
Post a Comment