尽管代码运行良好,但结果未显示。我有想念吗?
# Independent variables
x1 = 'a'
x2 = 'b'
# Dependent variable
y = 'c'
# Pairings
x1y = cor.loc[ x1, y ]
x2y = cor.loc[ x2, y ]
x1x2 = cor.loc[ x1, x2 ]
Rx1x2y = math.sqrt((abs(x1y**2) + abs(x2y**2) - 2*x1y*x2y*x1x2) / (1-
abs(x1x2**2)) )
R2 = Rx1x2y**2
# Calculate adjusted R-squared
n = len(data) # Number of rows
k = 2 # Number of independent variables
R2_adj = 1 - ( ((1-R2)*(n-1)) / (n-k-1) )
以上代码运行良好,但此处未显示结果。我期待输出中的R2,R2_adj值