function [p,Rsq] = LinearRegression (Xin,Yin)
% LinearRegression example
% x=0:1:9;
% y=3.0 * x + 7 + rand(1,length(x)) ;
% [p,Rsq] = LinearRegression (x,y) ;
% yfit = p(1)*x + p(2) ;
% plot(x,y,"o",x,yfit) ;
p = polyfit(Xin,Yin,1);
Yfit = p(1) * Xin + p(2);
Yresid = Yin - Yfit;
SSresid = sum(Yresid.^2);
SStotal = (length(Yin)-1) * var(Yin);
Rsq = 1 - SSresid/SStotal;
This is not a blog, but my notes and tips for research. Feel free to take any information and leave any comments or questions.
Search This Blog
Saturday, September 12, 2015
Subscribe to:
Post Comments (Atom)
Labels
- Academic Notes (4)
- BLAS (1)
- CEE618 (2)
- CentOS (1)
- Computation (1)
- Conferences (1)
- Cross compiling (1)
- Graphics (1)
- Hawaii Tour (2)
- Intel compiler (1)
- Just (1)
- Laptop (1)
- LaTex (22)
- Life and Humanity (8)
- Linux and Computing (107)
- LSF (1)
- Lyx (3)
- Macintosh (5)
- MPI (1)
- News (11)
- OpenFoam (1)
- OpenMPI (1)
- PBS (2)
- Software (4)
- SSH (2)
- torque (1)
- Touchpad (1)
- VMD (1)
- yum (1)
No comments:
Post a Comment