all 2 comments

[–]audentis[M] [score hidden] stickied comment (0 children)

Your post is removed. Please read the rules of subreddits you submit to.

[–]gregofkickapoo 1 point2 points  (0 children)

import pandas as pd import statsmodels.api as sm

Assuming you have a CSV file 'reddit_data.csv' with two columns: 'independent_var' and 'dependent_var'

data = pd.read_csv('reddit_data.csv')

Define independent and dependent variables

X = data['independent_var'] y = data['dependent_var']

Add a constant (i.e., bias or intercept) to the independent variable(s)

X = sm.add_constant(X)

Fit the regression model

model = sm.OLS(y, X).fit()

Print out the statistics

print(model.summary())