Posts

Showing posts with the label statistics

Statsmodels.formula.api OLS does not show statistical values of intercept

Statsmodels.formula.api OLS does not show statistical values of intercept I am running the following source code: import statsmodels.formula.api as sm # Add one column of ones for the intercept term X = np.append(arr= np.ones((50, 1)).astype(int), values=X, axis=1) regressor_OLS = sm.OLS(endog=y, exog=X).fit() print(regressor_OLS.summary()) where X is an 50x5 (before adding the intercept term) numpy array which looks like this: X [[0 1 165349.20 136897.80 471784.10] [0 0 162597.70 151377.59 443898.53]...] and y is a a 50x1 numpy array with float values for the dependent variable. y The first two columns are for a dummy variable with three different values. The rest of the columns are three different indepedent variables. Although, it is said that the statsmodels.formula.api.OLS adds automatically an intercept term (see @stellacia's answer here: OLS using statsmodel.formula.api versus statsmodel.api) its summary does not show the statistical values of the intercept term as it e...

Call Log-Likelihood in Statsmodels RegressionResults?

Call Log-Likelihood in Statsmodels RegressionResults? After running OLS with Statsmodels, I'm interested in the Log-Likelihood for comparing the fit of different models. I'm able to obtain the Log-Likelihood through the res.summary() function, but since I'm not interested in all available results in this summary, I would like to only call the Log-Likelihood. res.summary() I consulted the documentation of RegressionResults, but this gives me no answer. Can anybody tell me whether it is possible to obtain the Log-Likelihood result on its own? 1 Answer 1 Try below. It gives the same Log-Likelihood in summary on its own. print(res.llf) By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.