Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use the Statistical Library statsmodels in Python

Shulou Source: shulou.com Published: 2022-06-01 20:24:17 09月30日 Update

This article mainly shows you "how to use the statistical library statsmodels in Python", which is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to use statsmodels in Python".

Statsmodels is a Python module that provides classes and capabilities for estimating many different statistical models.

Let me show you the documentation page of this library. With so much statistical knowledge, I only read Linear Regression.

I only saw OLS in the Linear Regression part.

OLS I only tried the fit method today.

Statsmodel Chinese materials are not much, there are statistical needs and good English, welcome to eat. O (∩ _ ∩) obliteration enriches the statistical ability of my python circle. Of course, R is much richer and more detailed in this aspect of statistics, there is no need for Python, the right tools are used in the right place. Python and R, stata, spss and excel have their own advantages and disadvantages and can complement each other.

Let's take a look at the following small cases.

Small case study:

Import statsmodels.api as sm

Y = [1,3,4,5,2,3,4]

X = range (1,8)

# add intercept item

X = sm.add_constant (X)

Model = sm.OLS (Y, X)

# data fitting, generating model

Results = model.fit ()

Print (results.summary ())

After the run is complete, output the model overview

The above is all the contents of the article "how to use statsmodels in Python". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Statistics Zhongtong content model article appropriate case knowledge learning help different detailed necessary functional local good tools data documents methods Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple macOS NVidia Xiaomi Docker