First thing I would correct is the:
for(i=0; i<=n; i++)
in lines 54 and 65. I'm pretty sure this should be:
for(i=0; i<n; i++)
This is probably not the mathematical problem, as you are probably adding an extra 0.0.
Note that this error is masked by your arrays being 15 long, and your data being 14 long.
There is another "future problem" / style issue in lines 10 to 13:
See
http://www.cplusplus.com/forum/general/33612/#msg180771
which describes declaring variables as close as possible to where they are used.
Note that
i
is used "uninitialized" to zero from lines 25 on-wards. However this is not a problem as these variable are initialized to zero on start up.
Your main problem is that you don't calculate SumX2 and SumXY correctly. They should be done term-by-term. So presumably in a loop like SumX and SumY.
Also, as a computational issue, you have called sumX() and sumY() a number of times. Do these once each, and assign result to a variable, and use that variable thereafter. eg
float SumX = sumX();