LOGPEARSONDIST and LOGNORMALDIST Function in PHP

In summary, the conversation discusses the use of the JS library formulajs.info/functions and the functions lognormdist and logpearsondist. These functions are used to calculate the cumulative lognormal and Pearson distributions, which are not part of JavaScript but can be found in the PHP library. It is suggested to search for a PHP library or to write and test your own classes, as the implementation of these distributions is not trivial. The PHP statistics extension has functions that can be used for this purpose, such as stats_cdf_normal() and stat_dens_normal().
  • #1
gind_id
1
0
TL;DR Summary
I need function of lognormdist and logpearsondist in PHP code.
for reference you can see JS in formulajs.info/functions.
lognormdist use by call : formulajs.LOGNORMDIST(value, mean, stdev, true)
logpearsondist use by call : formulajs.NORMSDIST(z, true)

anybody can help?
 
Last edited:
Technology news on Phys.org
  • #2
These are not part of JavaScript, they are part of a JS library. I suggest you search for a PHP library using search terms like 'PHP lognormal'.

Having said that, if you know enough statistics and enough PHP to use such a library effectively it is probably quicker to write and test your own classes.

Edit: I didn't realize that the final argument true in the two example function calls flags a request for the cumulative lognormal/Pearson distributions respectively. Implementing the CDF for such a distribution is not trivial as there is no analytic solution, although numerical methods are well documented.
 
Last edited:
  • Like
Likes gind_id
  • #3
it would help if the formula.ps page you linked actually provided any explanation of what the functions do or what their arguments are. But based on the Excel NORM.S.DIST and LOGNORM.DIST functions I believe the PHP statistics extention has all you require.

stats_cdf_normal() returns the CDF of the normal distribution and stat_dens_normal() returns the PDF. To obtain the standard normal distribution, pass a mean of 0 and a variance of 1.

There is no lognormal function, but you can easily derive it from the standard normal distribution (as explained on the Excel documentation linked above).[/url]
 
Last edited:
  • Like
Likes gind_id

1. What does the LOGPEARSONDIST function in PHP do?

The LOGPEARSONDIST function in PHP calculates the probability density function of the lognormal distribution.

2. How do I use the LOGPEARSONDIST function in PHP?

To use the LOGPEARSONDIST function, you need to provide the function with four parameters: x, mean, standard deviation, and cumulative. The function will then calculate the probability density function at the given value of x.

3. What is the difference between the LOGPEARSONDIST and LOGNORMALDIST functions in PHP?

The LOGPEARSONDIST and LOGNORMALDIST functions both calculate the probability density function of the lognormal distribution. However, the LOGPEARSONDIST function allows for more flexibility by allowing you to specify the mean and standard deviation, while the LOGNORMALDIST function assumes a default mean of 0 and standard deviation of 1.

4. Can the LOGPEARSONDIST and LOGNORMALDIST functions be used for any type of data?

Both functions are specifically designed for data that follows a lognormal distribution. If your data does not follow a lognormal distribution, these functions may not provide accurate results.

5. Are there any limitations to using the LOGPEARSONDIST and LOGNORMALDIST functions in PHP?

One limitation of these functions is that they assume a continuous distribution, meaning they may not be suitable for discrete data. Additionally, as with any statistical tool, the accuracy of the results depends on the quality and representativeness of the data being used.

Similar threads

  • Programming and Computer Science
6
Replies
187
Views
8K
  • Programming and Computer Science
Replies
13
Views
1K
  • Programming and Computer Science
Replies
21
Views
5K
  • Programming and Computer Science
Replies
15
Views
1K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
3
Views
331
  • Programming and Computer Science
Replies
4
Views
3K
  • Programming and Computer Science
Replies
6
Views
2K
  • Programming and Computer Science
Replies
13
Views
2K
  • Programming and Computer Science
4
Replies
107
Views
5K
Back
Top