Skip to content

Commit

Permalink
Merge pull request #606 from ccnmtl/ERD-347-multicol-se
Browse files Browse the repository at this point in the history
Added robust standard errors to the multicollinearity section
  • Loading branch information
Evan-CTL authored Dec 3, 2024
2 parents f763016 + 2814b6d commit 3ab92f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions media/js/src/simulations/simulation3/generatedData.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"intercept": -10.546,
"rvalue": 0.731,
"pvalue": 0,
"stderr": [0.087,0.055],
"stderr": [0.100,0.009],
"yRange": [30.549,140.994]
},
"x3": {
Expand All @@ -25,7 +25,7 @@
"intercept": -10.547,
"rvalue": 0.731,
"pvalue": 0,
"stderr": [0.121,0.011],
"stderr": [0.072,0.046],
"yRange": [46.917,201.349]
},
"xRange": [64,236],
Expand Down
6 changes: 5 additions & 1 deletion metricsmentor/main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,11 @@ def calculate_multiple_regression(request):
if x1_values.size and x2_values.size and y_values.size:
X = sm.add_constant(np.column_stack((x1_values, x2_values)))
model = sm.OLS(y_values, X)
result = model.fit()
if data.get('robust', False) is True:
cov_type = 'HC3'
else:
cov_type = 'nonrobust'
result = model.fit(cov_type=cov_type)

# Convert NumPy arrays to Python lists
stderr_list = result.bse.tolist()
Expand Down

0 comments on commit 3ab92f4

Please sign in to comment.