Write the function rsq(x, y) that takes as parameters two lists of values, and calculates and returns the square of the

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Write the function rsq(x, y) that takes as parameters two lists of values, and calculates and returns the square of the

Post by answerhappygod »

Write The Function Rsq X Y That Takes As Parameters Two Lists Of Values And Calculates And Returns The Square Of The 1
Write The Function Rsq X Y That Takes As Parameters Two Lists Of Values And Calculates And Returns The Square Of The 1 (399.99 KiB) Viewed 28 times
Write the function rsq(x, y) that takes as parameters two lists of values, and calculates and returns the square of the correlation between those two data series, which is a measure of the goodness of fit measure to explain variation in y as a function of variation of x. >>> X = [4,4,3,6,7] >>> y = >>> rsq(x,y) 0.9831154684095857 [6,7,5,10,12] Additional Example: we expect no correlation and very low r-square between randomly selected data values. This test uses two lists of random numbers. Notice the very low r- squared. >>> import random >>> a = list(range(30)) >>> b = list (range(30)) >>> random.shuffle(a) >>> random.shuffle(b) >>> a [6, 24, 29, 8, 20, 7, 28, 23, 14, 11, 25, 19, 12, 17, 2, 0, 26, 9, 10, 1 >>> b [17, 22, 25, 29, 27, 7, 11, 19, 26, 16, 0, 9, 21, 18, 3, 24, 8, 10, 20, >>> correlation(a,b) 0.12880978865406006 >>> rsq(a,b) 0.016591961653103622
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply