histfit (histogram and normal function) (2024)

12 views (last 30 days)

Show older comments

Silvia on 19 Jan 2012

  • Link

    Direct link to this question

    https://uk.mathworks.com/matlabcentral/answers/26506-histfit-histogram-and-normal-function

  • Link

    Direct link to this question

    https://uk.mathworks.com/matlabcentral/answers/26506-histfit-histogram-and-normal-function

Accepted Answer: Wayne King

Good afternoon,

I have an histogram with data which I think it is not normal and I want to draw the normal density probability function over my histogram but the function I know 'histfit' uses normal data. Is there other functions which allow you to draw this curve with non normal data? or have I to convert my data to normal data? Thank you very much

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Sign in to answer this question.

Accepted Answer

Wayne King on 19 Jan 2012

  • Link

    Direct link to this answer

    https://uk.mathworks.com/matlabcentral/answers/26506-histfit-histogram-and-normal-function#answer_34612

Open in MATLAB Online

Hi Silvia, You're correct. There are a number of ways you can assess fit. For example, you can use kstest() with a specified probability distribution to construct a hypothesis test.

PD = ProbDistUnivParam('gamma',[1/2 2]); %chisquare 1 dof

x = chi2rnd(1,100,1);

[h,p] = kstest(x,PD);

You can use fitdist() to estimate the parameters of the distribution from your data.

In this case:

Pd = fitdist(x,'gamma');

To know which distribution is "best". Well that's tougher. I mean often you have a model for your data which indicates which is probably the right family. Other times it's more empirical, you're looking at histograms or estimates of the probablity density, see ksdensity(), and then based on that you can select a model.

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

More Answers (4)

Image Analyst on 19 Jan 2012

  • Link

    Direct link to this answer

    https://uk.mathworks.com/matlabcentral/answers/26506-histfit-histogram-and-normal-function#answer_34580

  • Link

    Direct link to this answer

    https://uk.mathworks.com/matlabcentral/answers/26506-histfit-histogram-and-normal-function#answer_34580

You mean like the plot() function? That can draw a line or curve.

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Wayne King on 19 Jan 2012

  • Link

    Direct link to this answer

    https://uk.mathworks.com/matlabcentral/answers/26506-histfit-histogram-and-normal-function#answer_34581

  • Link

    Direct link to this answer

    https://uk.mathworks.com/matlabcentral/answers/26506-histfit-histogram-and-normal-function#answer_34581

Open in MATLAB Online

Hi Silvia, histfit() with the 'normal' option does not use data which follows a Gaussian distribution, it uses the data you give it. If your data is non-Gaussian than the overlying fitted normal density will clearly not do a good job approximating your data histogram. For example:

x = chi2rnd(2,100,1);

histfit(x,[],'normal')

Note that in this case:

histfit(x,[],'gamma');

Does a much better job (of course).

Is this what you're asking?

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Silvia on 19 Jan 2012

  • Link

    Direct link to this answer

    https://uk.mathworks.com/matlabcentral/answers/26506-histfit-histogram-and-normal-function#answer_34585

  • Link

    Direct link to this answer

    https://uk.mathworks.com/matlabcentral/answers/26506-histfit-histogram-and-normal-function#answer_34585

So, If I understand histfit() uses my data (dataX), if my data is non-gaussian (normal) then 'histfit(dataX,[],'normal')won't do a good job. Nut now I have two questions: 1)Is there any function to know if my data is normal?? 2)In case is not normal can I make it normal?? and use histfit with that data??

3)I ask these questions because there is a lot of properties, I mean: weibull, lognormal,exponential .... and I don't know which is better for my data. Thank you very much

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Brian Wilson on 19 Jan 2012

  • Link

    Direct link to this answer

    https://uk.mathworks.com/matlabcentral/answers/26506-histfit-histogram-and-normal-function#answer_34618

  • Link

    Direct link to this answer

    https://uk.mathworks.com/matlabcentral/answers/26506-histfit-histogram-and-normal-function#answer_34618

Hi Silvia,

if you have the statistics toolbox there are a bunch of helpful functions.

Try normplot and it plots the sorted data against the normal distribution CDF. The helpful feature here is that the scale is nonlinear so that the CDF looks like a straight line. you can then look to see how well your data fits the straight line.

There is also normfit with a bunch of metrics. Take a look at the documentation.

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Sign in to answer this question.

See Also

Categories

AI, Data Science, and StatisticsStatistics and Machine Learning ToolboxDescriptive Statistics and Visualization

Find more on Descriptive Statistics and Visualization in Help Center and File Exchange

Tags

  • histfit (histogram and normal function)

Community Treasure Hunt

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

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.


histfit (histogram and normal function) (7)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

histfit (histogram and normal function) (2024)

References

Top Articles
Anatomy Drawing Lessons
Nguyen Phu Trong: Vietnam's long-serving leader dies at 80
The Largest Banks - ​​How to Transfer Money With Only Card Number and CVV (2024)
Craigslist Furniture Bedroom Set
Obituary (Binghamton Press & Sun-Bulletin): Tully Area Historical Society
Alpha Kenny Buddy - Songs, Events and Music Stats | Viberate.com
Miles City Montana Craigslist
Best Theia Builds (Talent | Skill Order | Pairing + Pets) In Call of Dragons - AllClash
J Prince Steps Over Takeoff
Xm Tennis Channel
Knaben Pirate Download
Www.paystubportal.com/7-11 Login
Https://Gw.mybeacon.its.state.nc.us/App
2016 Hyundai Sonata Price, Value, Depreciation & Reviews | Kelley Blue Book
Regal Stone Pokemon Gaia
Walthampatch
How Much Are Tb Tests At Cvs
Find Such That The Following Matrix Is Singular.
Rachel Griffin Bikini
Andhrajyothy Sunday Magazine
Jang Urdu Today
Traveling Merchants Tack Diablo 4
Icivics The Electoral Process Answer Key
Xsensual Portland
Sodium azide 1% in aqueous solution
Craigslist Pennsylvania Poconos
Lines Ac And Rs Can Best Be Described As
California Online Traffic School
55Th And Kedzie Elite Staffing
Violent Night Showtimes Near Johnstown Movieplex
Cona Physical Therapy
Bend Missed Connections
Past Weather by Zip Code - Data Table
Downloahub
Rush County Busted Newspaper
Kagtwt
Where Do They Sell Menudo Near Me
Ark Unlock All Skins Command
All Things Algebra Unit 3 Homework 2 Answer Key
2024 Ford Bronco Sport for sale - McDonough, GA - craigslist
Oppenheimer Showtimes Near B&B Theatres Liberty Cinema 12
Doe Infohub
Powerspec G512
✨ Flysheet for Alpha Wall Tent, Guy Ropes, D-Ring, Metal Runner & Stakes Included for Hunting, Family Camping & Outdoor Activities (12'x14', PE) — 🛍️ The Retail Market
Suntory Yamazaki 18 Jahre | Whisky.de » Zum Online-Shop
Vagicaine Walgreens
Leland Westerlund
Kenwood M-918DAB-H Heim-Audio-Mikrosystem DAB, DAB+, FM 10 W Bluetooth von expert Technomarkt
Lebron James Name Soundalikes
300 Fort Monroe Industrial Parkway Monroeville Oh
Coldestuknow
Unity Webgl Extreme Race
Latest Posts
Article information

Author: Msgr. Benton Quitzon

Last Updated:

Views: 6002

Rating: 4.2 / 5 (43 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Msgr. Benton Quitzon

Birthday: 2001-08-13

Address: 96487 Kris Cliff, Teresiafurt, WI 95201

Phone: +9418513585781

Job: Senior Designer

Hobby: Calligraphy, Rowing, Vacation, Geocaching, Web surfing, Electronics, Electronics

Introduction: My name is Msgr. Benton Quitzon, I am a comfortable, charming, thankful, happy, adventurous, handsome, precious person who loves writing and wants to share my knowledge and understanding with you.