Producing a distribution for categorical data

Hi,
I am relatively new to MATLAB, and to this point have been following tutorials slowly and effectively although came unstuck today.
In the following video, at around 37:00
the presenter uses the data he is extracted to produce a distribution. However as I understand it, my matlab package does not allow for the use of the function 'mpgdistribution()'. I don't fully understand how this function has been formed. I am looking for an alternative way of producing the same plot. I am capable of producing a histogram for MPG, but am unable to separate the data into two different distributions based on their category, (City/Highway).
Using R, I would use GGPlot. However, after around an hour of googling, Ive found no alternative.

 Accepted Answer

You can find all of the files in the video at the end of the discription, including mpgdistribution(). It basically contains codes to fit the Normal distribution to the data and draw some figures. It contains functions like fitdist() for distribution fitting and pdf() for probability density function, which requires Statistics and Machine Learning toolbox. You couldn't find documentation for mpgdistribution() because it is not a standard MATLAB library.
https://www.mathworks.com/matlabcentral/fileexchange/64219-beyond-excel-enhancing-your-data-analysis-with-matlab-august-2017

3 Comments

Great, thanks!
So am i right in saying that there is not a built in function in matlab that would quickly produce a plot like this? Instead you'd need to either create or copy a function into you working folder?
Exactly. You should also notice that mpg in mpgdistribution() refers to Mile Per Gallon (MPG), which is one of the variables in that example, so it wouldn't be a general MATLAB function.
Thanks.
Yes, I had understood what MPG was referring to, and was therefore confused how the function came about. Thanks for all your help

Sign in to comment.

More Answers (0)

Products

Release

R2017a

Community Treasure Hunt

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

Start Hunting!