Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R2 #23

Open
xiahui1986 opened this issue Jan 23, 2019 · 2 comments
Open

R2 #23

xiahui1986 opened this issue Jan 23, 2019 · 2 comments

Comments

@xiahui1986
Copy link

有没有返回R平方的值?

@lgxnas
Copy link

lgxnas commented May 30, 2019

不平方,R值也可以,望开放

@lgxnas
Copy link

lgxnas commented May 31, 2019

不平方,R值也可以,望开放

var n=data.length,sumxy=0,sumx=0,sumy=0,hypotx=0,hypoty=0;
for(let i=0;i<n;i++){
sumx+=data[i][0];
sumy+=data[i][1];
sumxy+=data[i][0]*data[i][1];
hypotx+=Math.pow(data[i][0],2);
hypoty+=Math.pow(data[i][1],2);
}
var r=(n*sumxy-sumx*sumy)/(Math.sqrt(n*hypotx-Math.pow(sumx,2))*Math.sqrt(n*hypoty-Math.pow(sumy,2)));
自己弄了个

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants