Bows to the wise perlmonks
Hi I have 2 files:FILE1: <snip> 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 </snip> FILE2: <snip> 2 1 2 2 1 2 2 2 1 2 2 2 2 1 2 2 1 2 2 2 1 2 2 2 </snip>
How do I go down each line in each file and work out the $r-squared value for each line in each file. The code I have so far as below.....MANY THANKS IN ADVANCE
#!/usr/bin/perl open (DATA, "FILE1"); @geno = <DATA>; open (DATA2, "FILE2"); @dos = <DATA2>; foreach (1..4){ $num=$_; $dosage = $dos[$num]; $genotype = $geno[$num]; rsquared($dosage, $genotype); } sub rsquared( $dosage =shift; $genotype =shift; ###HELP HERE TO FIND R-squared )
Added in more info as to what R2 is as below, thanks for everyones help The coefficient of determination R2 is used in the context of statistical models whose main purpose is the prediction of future outcomes on the basis of other related information. It is the proportion of variability in a data set that is accounted for by the statistical model.1 It provides a measure of how well future outcomes are likely to be predicted by the model. <code> Thanks for everyones help on this. I have made use of the wondeful code below... One last question in passing: A question in passing do you know why this online calculator http://easycalculation.com/statistics/r-squared.php can find r^2 (but not r) on values: "2,2,2,2" "2,2,2,1" Is that a bug on their software? Thanks again </code
In reply to finding R-squared..please help by david_lyon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |