Solved

Normal Distribution with PHP

Posted on 2006-11-07
5
2,864 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
[X]
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
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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 …

724 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