[phpBB Debug] PHP Warning: in file [ROOT]/ext/lmdi/autolinks/event/listener.php on line 237: Undefined array key 14
[phpBB Debug] PHP Warning: in file [ROOT]/ext/lmdi/autolinks/event/listener.php on line 237: Trying to access array offset on value of type null
Answer Happy • Write the function rsq(x, y) that takes as parameters two lists of values, and calculates and returns the square of the
Page 1 of 1

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

Posted: Mon Jul 11, 2022 9:54 am
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 30 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