Goodness of fit of regression equation

Source: Internet
Author: User

In multivariate regression, the increment of the independent variable will enlarge the R-squared, in order to avoid overestimating R-Squared, using the multiple determinant coefficients of adjustment:

Adjusted multiple coefficient of determination, recorded as R_a Square

r_a_square=1-(1-r**2) * ((n-1)/(n-k-1))

Python encoding

# adjusted multiple coefficient of determination adjustment multiple determinant coefficients
def r_a_square (r,n,k):
#n is the number of samples, K is the argument of arguments

r_a_suare=1-(1-r**2) * ((n-1) *1.0/(n-k-1)) #注意除法一定要添加浮点数, otherwise operation error
Return R_a_suare

Goodness of fit of regression equation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.