note 108615 added to function.stats-stat-correlation
| From: | 4705266 at gmail dot com | Date: | Thu, 10 May 2012 22:48:27 +0000 |
| Subject: | note 108615 added to function.stats-stat-correlation | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-187924@lists.php.net to get a copy of this message | ||
/***************************************\
â«âªâ«âªâ«â¥âªâ«âªâªâ«Fatih Mehmet DAÄ
â«âªâªâ¥â¥â¥â¥â¥â«âªâª
â«âªâ«â¥âªâªâ«â¥â«âªâª F.M.D.
âªâªâ«â¥âªâªâ«â«âªâ«â«
â«â«âªâ¥â¥â¥â¥â¥âªâ«â«4705266@gmail.com
â«â«âªâ¥â¥â¥â«âªâ«âªâ«
â«âªâ«â¥â«âªâªâ¥âªâ«âªwww.fatihdag.com
â«â«âªâ¥âªâ«âªâ«âªâ«âª
âªâ«âªâ¥â«âªâ«â¥â«âªâ«11-05-2012
00:42:15âªâ«âªâ¥â«âªâ«âªâ«âªâ«
\***************************************/
function getCorrelation($x_array,$y_array){
//CODED by F.M.D
$tx=0;
$ty=0;
$txy=0;
$txx=0;
$tyy=0;
$n=count($x_array);
foreach($x_array as $a=>$b){
$xy[]=$b*$y_array[$a];
$xx[]=$b*$b;
$yy[]=$y_array[$a]*$y_array[$a];
$tx+=$b;
$ty+=$y_array[$a];
$txy+=($b*$y_array[$a]);
$txx+=($b*$b);
$tyy+=($y_array[$a]*$y_array[$a]);
}
return (($n)*($txy)-($tx)*($ty))/sqrt((($n*$txx)-($tx*$tx) )*(($n*$tyy)-($ty*$ty))) ;
}
$x[]=60;
$y[]=3.1;
$x[]=61;
$y[]=3.6;
$x[]=62;
$y[]=3.8;
$x[]=63;
$y[]=4;
$x[]=65;
$y[]=4.1;
$r= getCorrelation($x,$y);
echo "r^2 = $r";
output: r^2 = 0.91187249533773
----
Server IP: 69.147.83.197
Probable Submitter: 94.55.1.186
----
Manual Page -- http://www.php.net/manual/en/function.stats-stat-correlation.php
Edit -- https://master.php.net/note/edit/108615
Del: integrated -- https://master.php.net/note/delete/108615/integrated
Del: useless -- https://master.php.net/note/delete/108615/useless
Del: bad code -- https://master.php.net/note/delete/108615/bad+code
Del: spam -- https://master.php.net/note/delete/108615/spam
Del: non-english -- https://master.php.net/note/delete/108615/non-english
Del: in docs -- https://master.php.net/note/delete/108615/in+docs
Del: other reasons-- https://master.php.net/note/delete/108615
Reject -- https://master.php.net/note/reject/108615
Search -- https://master.php.net/manage/user-notes.php