Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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
1  
No code?$\phantom{}$ –  J. M. Jun 4 '13 at 2:26
1  
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
add comment

1 Answer 1

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. –  Azeem 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? –  Azeem 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. –  Azeem Jun 4 '13 at 6:33
show 2 more comments

Your Answer

 
discard

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.