Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Normal Distribution with PHP

Posted on 2006-11-07
5
2,846 Views
Last Modified: 2007-12-19
Anyone know how to find the normal distribution value using PHP?  I have mean, std dev, and the z-score.

Excel finds it via NORMSDIST(z).  I want to hand code it, something like:

$normdist($zScore) = //calc for norms

Or would I be better off using javascript?

Any ideas appreciated.  
0
Comment
Question by:south_paw
  • 3
5 Comments
 

Author Comment

by:south_paw
ID: 17892062
I found this on the web, I'm going to try to convert it....

Help appreciated!


Function u_SNorm(z)

    c1 = 2.506628
    c2 = 0.3193815
    c3 = -0.3565638
    c4 = 1.7814779
    c5 = -1.821256
    c6 = 1.3302744
    If z > 0 Or z = 0 Then
              w = 1
    Else: w = -1
    End If
    y = 1 / (1 + 0.2316419 * w * z)
    u_SNorm = 0.5 + w * (0.5 - (Exp(-z * z / 2) / c1) * _
            (y * (c2 + y * (c3 + y * (c4 + y * (c5 + y * c6))))))
           
End Function
0
 

Author Comment

by:south_paw
ID: 17892155
I think i just answered my on Qeustion:

      $c1 = 2.506628;
    $c2 = 0.3193815;
    $c3 = -0.3565638;
    $c4 = 1.7814779;
    $c5 = -1.821256;
    $c6 = 1.3302744;
    if ($z1 > 0 )
             $w = 1;
    else $w = -1;
   
    $y = 1 / (1 + 0.2316419 * $w * $z1);
    $normDist = 0.5 + $w * (0.5 - (exp(-$z1 * $z1 / 2) / $c1) * _
            ($y * ($c2 + $y * ($c3 + $y * ($c4 + $y * ($c5 + $y * $c6))))));
                  
                  echo $normDist;

0
 

Author Comment

by:south_paw
ID: 17892203
Please close Q and refund points, I solved all by my lelf.
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 17893092
You can request a refund by posting in the community support area. See the "support" link in the topright menu.

-r-
0
 

Accepted Solution

by:
CetusMOD earned 0 total points
ID: 17920614
Closed, 500 points refunded.
CetusMOD
Community Support Moderator
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Cpanel file manager 8 41
php56-php-mcrypt for rhel7 php56 1 48
ajax to record click 3 16
form validation - make sure at least 1 checkbox is selected 18 29
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question