how to plot to get four plots of descriptive statistics in one figure

1 Ansicht (letzte 30 Tage)
I have attached the descriptive statistics of 4 different zones below.
Can you help me how to get the four plots in one figure?

Akzeptierte Antwort

dpb
dpb am 19 Jan. 2020
You haven't kep the underlying data in the summary statistics so can't do the histogram from those statistics alone. It's simple enough to use subplot and the example at <Histogram + PDF Plot>. Presuming you have the Statistics Toolbox, it's much simpler to use normpdf and fplot to generate the theoretical pdf curve than having to write the solution manually, however.
For the general idea, can generate a random sample and use it in lieu of the actual data...
load gjhasta
hAx=gobjects(4,1);
for i=1:4
hAx(i)=subplot(2,2,i);
mn=desc1{1,i+1};
sd=desc1{2,i+1};
histogram(randn(1000,1)*sd+mn,'Normalization','pdf');
hold on
z=mn+linspace(-3,3);
plot(z,normpdf(linspace(-3,3)))
end
results in
untitled.jpg
  11 Kommentare
dpb
dpb am 20 Jan. 2020
"I have used also histogram(rawData(:,i),'Normalization','pdf');"
That looks fine by itself; I had no problem with the barebones
load rawdata
figure, for i=1:4,subplot(2,2,i),histogram(rawData(:,i),'Normalization','pdf');end
at the command line, so you've got something else going on in the code you're actually trying to run.
Without the identical code and the error message in context of the session in which it's run, can't say what nor where your error is...but, it will work if you go through very carefully and make sure you're addressing a table variable with the curlies "{}" to return the underlying data as double and the array of doubles with ordinary parentheses.
I will note these data are all strongly bi-modal; a single normal won't fit the data worth anything. They're also strongly skewed to the right like maybe lognormal or extreme value or similar...
untitled.jpg
dpb
dpb am 20 Jan. 2020
Bearbeitet: dpb am 20 Jan. 2020
How could you possibly do that??? What's to plot? All you have is a set of point statistics and for such a data set, single point measures would appear to be almost meaningless.
What is the end point you're trying to reach?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

dpb
dpb am 20 Jan. 2020
Bearbeitet: dpb am 20 Jan. 2020
Revised to use the real data and the fitted statistics...as noted above, you can't represent these distributions at all fairly by a simple single-moded distribution nor summary set of statistics...
Code that produced these:
hAx=gobjects(4,1);
for i=1:4
hAx(i)=subplot(2,2,i);
mn=desc1{1,i+1};
sd=desc1{5,i+1};
mnm=desc1{10,i+1};
mxm=desc1{11,i+1};
h=histogram(rawData(:,i),'Normalization','pdf');
hold on
z=linspace(mnm,mxm);
plot(z,normpdf(z,mn,sd))
end
  4 Kommentare
gjashta
gjashta am 22 Jan. 2020
Hi dpb! Sorry for the late reply! My objective here is just to describe and understand the features of this data.
dpb
dpb am 22 Jan. 2020
Well, visualization is obviously the first key...if you had simply looked only at the summary statistics computed, you'd have a totally different idea, probably.
"Describing" can mean a lot of things; what's the end result of this description to serve to do?
Where do the data come from; looks like should be a relatively easy fitting problem for a combination of two unimodal distributions but unless one knows what generated the bimodal result whether that's the appropriate model is yet unknown.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by