PHP | stats_cdf_noncentral_f() Function

PHP | stats_cdf_noncentral_f() Function


Hello folks! welcome back to a new edition of our tutorial on PHP. In this tutorial guide, we are going to be studying about the PHP stats_cdf_noncentral_f() Function.

The PHP stats_cdf_noncentral_f() function is used to calculate any one parameter of non-central f distribution specified values for the others.

Syntax

Following below is the syntax to use this function -

float stats_cdf_noncentral_f( float $par1, float $par2, float $par3, float $par4, int $which )


Parameter Details

Sr.NoParameterDescription
1

par1

The first parameter

2

par2

The second parameter

3

par3

The third parameter

4

par4

The fourth parameter

5

which

The flag to determine what to be calculated


Return Value

This built-in function can return the CDF, its inverse, or one of its parameters of the non-central f distribution. The kind of the return value and parameters (par1, par2, par3, and par4) are determined by which.

The following table list the return value and parameters by which.

  • CDF denotes cumulative distribution function.
  • x denotes the value of random variable.
  • nu1, nu2 denotes the degree of freedom of the distribution.
  • lambda denotes the non-centrality parameter of the distribution.

whichReturn valuepar1par2par3par4
1CDFxnu1nu2lambda
2xCDFnu1nu2lambda
3nu1xCDFnu2lambda
4nu2xCDFnu1lambda
5lambdaxCDFnu1nu2

Dependencies

This built-in function was first introduced in statistics extension (PHP version 4.0.0 and PEAR v1.4.0). In this tutorial guide, we used the latest release of stats-2.0.3 (PHP v7.0.0 or newer and PEAR version 1.4.0 or newer).

Example1

In the following example below, when which = 1, calculate P from (F, DFN, DFD, PNONC).

  • P is the integral from 0 to F of the non-central f-density.
  • F is the upper limit of integration of the non-central f-density.
  • DFN is the degree of freedom of the numerator sum of squares.
  • DFD is the degree of freedom of the denominator sum of squares.
  • PNONC is the non-centrality parameter of the non-central f-density.

<?php
   // which = 1 : calculate P from (F, DFN, DFD, PNONC)
   var_dump(round(stats_cdf_noncentral_f(5, 2, 3, 4, 1), 6));
?>

Output

When the above code is executed, it will produce the following result -

float(0.650459)

Example2

In the following example below, when which = 2, calculate F from (P, DFN, DFD, PNONC).

  • P is the integral from 0 to F of the non-central f-density.
  • F is the upper limit of integration of the non-central f-density.
  • DFN is the degree of freedom of the numerator sum of squares.
  • DFD is the degree of freedom of the denominator sum of squares.
  • PNONC is the non-centrality parameter of the non-central f-density.

<?php
   // which = 2 : calculate F from (P, DFN, DFD, PNONC)
   var_dump(round(stats_cdf_noncentral_f(0.650459043, 2, 3, 4, 2), 6));
?>

Output

When the above code is executed, it will produce the following result -

float(5)

Example3

In the following example below, when which = 3, calculate DFN from (P, F, DFD, PNONC).

  • P is the integral from 0 to F of the non-central f-density.
  • F is the upper limit of integration of the non-central f-density.
  • DFN is the degree of freedom of the numerator sum of squares.
  • DFD is the degree of freedom of the denominator sum of squares.
  • PNONC is the non-centrality parameter of the non-central f-density.

<?php
   // which = 3 : calculate DFN from (P, F, DFD, PNONC)
   var_dump(round(stats_cdf_noncentral_f(0.650459043, 5, 3, 4, 3), 6));
?>

Output

When the above code is executed, it will produce the following result -

float(2)

Example4

In the following example below, when which = 4, calculate DFD from (P, F, DFN, PNONC).

  • P is the integral from 0 to F of the non-central f-density.
  • F is the upper limit of integration of the non-central f-density.
  • DFN is the degree of freedom of the numerator sum of squares.
  • DFD is the degree of freedom of the denominator sum of squares.
  • PNONC is the non-centrality parameter of the non-central f-density.

<?php
   // which = 4 : calculate DFD from (P, F, DFN, PNONC)
   var_dump(round(stats_cdf_noncentral_f(0.650459043, 5, 2, 4, 4), 6));
?>

Output

When the above code is executed, it will produce the following result -

float(3)

Example5

In the following example below, when which = 5, calculate PNONC from (P, F, DFN, DFD).

  • P is the integral from 0 to F of the non-central f-density.
  • F is the upper limit of integration of the non-central f-density.
  • DFN is the degree of freedom of the numerator sum of squares.
  • DFD is the degree of freedom of the denominator sum of squares.
  • PNONC is the non-centrality parameter of the non-central f-density.

<?php
   // which = 5 : calculate PNONC from (P, F, DFN, DFD)
   var_dump(round(stats_cdf_noncentral_f(0.650459043, 5, 2, 3, 5), 6));
?>

Output

When the above code is executed, it will produce the following result -

float(4)

Example6

Following is an error case. In the following example below which<1, warning message is displayed in logs.

<?php
   var_dump(round(stats_cdf_noncentral_f(1, 2, 3, 4, 0), 6));      // which < 1
?>

Output

The above code will produce the following result and a warning in logs PHP Warning: stats_cdf_noncentral_f(): Fourth parameter should to be in the 1..5 range.

float(0)

Example7

Following is an error case. In the following example below which>4, warning message is displayed in logs.

<?php
   var_dump(round(stats_cdf_noncentral_f(1, 2, 3, 4, 6), 6));      // which > 5
?>

Output

The above code will produce the following result and a warning in logs PHP Warning: stats_cdf_noncentral_f(): Fourth parameter should to be in the 1..5 range.

float(0)


Alright guys! This is where we are going to be rounding up for this tutorial post. In our next tutorial, we are going to be discussing about the stats_cdf_noncentral_t() Function in PHP.

Feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.

Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.

Thanks for reading and bye for now.