简体   繁体   中英

How to implement histfit in r?

There is histfit function in Matlab would plot histogram and fit the distribution by bin values. The distribution's parameters have to be estimated. How to implement histfit in r? I searched for a long time, but it has no lucky.

This post have mentioned this before, but there is no preferable solution. The sn package seems support several distribution, not so much.

I explore the data with hist function, the histogram shows gamma distribution in gerneral. But if I add up bins and show it again, the graph will show more details, and gamma distribution fails. fitdistr would fail to find parameters also. so I want to fit the data just using the coarse data from histogram. This is the question, thank you for your help.

The fitdistr function in the MASS package can be used to find parameters for a given distribution (including gamma). The function density and the logspline package (and others) can be used to estimate the density function of the data without assuming a specific distribution.

The lines and curve functions can be used to add an estimated density curve to a plotted histogram (use prob=TRUE when creating the histogram).

If you want to compare your data to a specific distribution then tools like qqplots ( qqplot function or others) or visual tests ( vis.test in the TeachingDemos package) will probably be better than a histogram and density plot.

我必须自己回答,包'bda'可以将分箱数据放在几个分布中,但是它只能通过舍入来分组数据。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM