What are Robust Linear Models in the StatsModels library?

In this recipe, you will learn what are Robust Linear Models in StatsModels.

Recipe Objective - What are Robust Linear Models in the StatsModels library?

In robust statistics, robust regression is a form of regression analysis designed to overcome some limitations of traditional parametric and nonparametric methods. Regression analysis attempts to find a relationship between independent and dependent variables.

Access Linear Regression ML Project for Beginners with Source Code 

For more related projects -

https://www.dezyre.com/projects/data-science-projects/deep-learning-projects
https://www.dezyre.com/projects/data-science-projects/neural-network-projects

Example:

# Importing libraries
import statsmodels.api as sm
import statsmodels.formula.api as smf

# Importing heart dataset from statsmodels in the form of pandas dataframe
data = sm.datasets.heart.load_pandas()

# Storing data
X = data.data

# Fit and summarize RLM model with 'survival' as dependent variable and 'censors and age' as independent variables
model = sm.RLM(X['survival'], X[['censors','age']])
model = model.fit()

# Model summary
model.summary()

Output - 
Robust linear Model Regression Results
Dep. Variable:	survival	No. Observations:	69
Model:	RLM	Df Residuals:	67
Method:	IRLS	Df Model:	1
Norm:	HuberT		
Scale Est.:	mad		
Cov Type:	H1		
Date:	Mon, 22 Nov 2021		
Time:	17:54:34		
No. Iterations:	12		
coef	std err	z	P>|z|	[0.025	0.975]
censors	-401.9997	95.165	-4.224	0.000	-588.521	-215.479
age	11.7641	1.636	7.190	0.000	8.557	14.971

In this way, we can use Robust Linear Models in the statsmodels library.

What Users are saying..

profile image

Gautam Vermani

Data Consultant at Confidential
linkedin profile url

Having worked in the field of Data Science, I wanted to explore how I can implement projects in other domains, So I thought of connecting with ProjectPro. A project that helped me absorb this topic... Read More

Relevant Projects

Time Series Classification Project for Elevator Failure Prediction
In this Time Series Project, you will predict the failure of elevators using IoT sensor data as a time series classification machine learning problem.

Machine Learning Project to Forecast Rossmann Store Sales
In this machine learning project you will work on creating a robust prediction model of Rossmann's daily sales using store, promotion, and competitor data.

Predictive Analytics Project for Working Capital Optimization
In this Predictive Analytics Project, you will build a model to accurately forecast the timing of customer and supplier payments for optimizing working capital.

NLP Project on LDA Topic Modelling Python using RACE Dataset
Use the RACE dataset to extract a dominant topic from each document and perform LDA topic modeling in python.

AWS MLOps Project for Gaussian Process Time Series Modeling
MLOps Project to Build and Deploy a Gaussian Process Time Series Model in Python on AWS

Loan Eligibility Prediction using Gradient Boosting Classifier
This data science in python project predicts if a loan should be given to an applicant or not. We predict if the customer is eligible for loan based on several factors like credit score and past history.

AWS MLOps Project for ARCH and GARCH Time Series Models
Build and deploy ARCH and GARCH time series forecasting models in Python on AWS .

Word2Vec and FastText Word Embedding with Gensim in Python
In this NLP Project, you will learn how to use the popular topic modelling library Gensim for implementing two state-of-the-art word embedding methods Word2Vec and FastText models.

Build a Churn Prediction Model using Ensemble Learning
Learn how to build ensemble machine learning models like Random Forest, Adaboost, and Gradient Boosting for Customer Churn Prediction using Python

Walmart Sales Forecasting Data Science Project
Data Science Project in R-Predict the sales for each department using historical markdown data from the Walmart dataset containing data of 45 Walmart stores.