Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to draw a histogram and some line plots together. I have one observed variable and several predicted ones. Observed data should be shown as a histogram and the predicted variables should be shown as line plots or smooth histograms. I use Mathematica 7. Please help me to show which fitted distribution is best.

share|improve this question
No code?$\phantom{}$ – J. M. Jun 4 '13 at 2:26
Sharing your research helps everyone. Tell us what you found and why it didn’t meet your needs. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and most of all it helps you get a more specific and relevant answer:) Good Luck! – WolframFan Jun 4 '13 at 2:35

Something like this?

data = RandomVariate[NormalDistribution[0, 5], 10^4];
dist = {EstimatedDistribution[data, NormalDistribution[mu, sigma]], 
   EstimatedDistribution[data, StudentTDistribution[mu, sigma, 5]]};
pdfs = PDF[#, x] & /@ dist;
Show[{Histogram[data, Automatic, "ProbabilityDensity"], 
  Plot[pdfs, {x, Min[data], Max[data]}, PlotLegends -> dist]}]

enter image description here

share|improve this answer
yes I have same problem, but I have new distribution and real data set. I have calculated predicted values, so how I can sketch same histogram with data sets. – SAAN Jun 4 '13 at 5:25
Replace data with data={1,2,3,... } whatever your data set is and replace the NormalDistribution and StudentTDistribution with whatever you're using. – Cam Jun 4 '13 at 5:40
thanks Cam for your reply, data={1,2,3,..} works but how i can replace NormalDistribution with the expression? – SAAN Jun 4 '13 at 6:14
Just change dist, like this dist = {EstimatedDistribution[data,SkewNormalDistribution[mu, sigma, alpha]]} – Cam Jun 4 '13 at 6:22
Sorry Cam, I have distribution with six parameters and not listed in literature as well in Mathematica. So I have expression. Through SAS I already calculate the estimated values. please either help me to write expression instead the name of distribution or using estimated value. Thanks for your valuable comments. – SAAN Jun 4 '13 at 6:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.