How to plot cauchy distribution in R?

This recipe helps you plot cauchy distribution in R

Recipe Objective

Cauchy distribution is a type of continuous probability distribution which is also known as Lorentz distribution. It resembles normal distribution curve but has a taller peak with tails decaying much more slowly than normal distribution. ​

It is mainly used as an example of a "pathological" distribution due to an undefined variance. ​

In this recipe, we will learn how to plot cauchy distribution. ​

Step 1: Creating a variable to be plotted on x-axis

We will use sequence (seq()) function to do the same. ​

# creating numbers to plot between -5 and 5 with a difference of 0.01 between each of them x_cauchy = seq(-5, 5, by = 0.01)

Step 2: Plotting a cauchy density distribution

We use dcauchy() and plot() function to carry out the task ​

plot(x_cauchy, # x-values dcauchy(x_cauchy), # y-values type = "l", # lineplot col = "red", #colour of the line lwd = 2, # line width xlab = "X-values", # x-label ylab = "Probability density", # y-label main = "Cauchy Distribution") # title

What Users are saying..

profile image

Ameeruddin Mohammed

ETL (Abintio) developer at IBM
linkedin profile url

I come from a background in Marketing and Analytics and when I developed an interest in Machine Learning algorithms, I did multiple in-class courses from reputed institutions though I got good... Read More

Relevant Projects

Multilabel Classification Project for Predicting Shipment Modes
Multilabel Classification Project to build a machine learning model that predicts the appropriate mode of transport for each shipment, using a transport dataset with 2000 unique products. The project explores and compares four different approaches to multilabel classification, including naive independent models, classifier chains, natively multilabel models, and multilabel to multiclass approaches.

MLOps Project to Deploy Resume Parser Model on Paperspace
In this MLOps project, you will learn how to deploy a Resume Parser Streamlit Application on Paperspace Private Cloud.

MLOps Project to Build Search Relevancy Algorithm with SBERT
In this MLOps SBERT project you will learn to build and deploy an accurate and scalable search algorithm on AWS using SBERT and ANNOY to enhance search relevancy in news articles.

Build a Hybrid Recommender System in Python using LightFM
In this Recommender System project, you will build a hybrid recommender system in Python using LightFM .

Hands-On Approach to Regression Discontinuity Design Python
In this machine learning project, you will learn to implement Regression Discontinuity Design Example in Python to determine the effect of age on Mortality Rate in Python.

Build a Multi ClassText Classification Model using Naive Bayes
Implement the Naive Bayes Algorithm to build a multi class text classification model in Python.

Text Classification with Transformers-RoBERTa and XLNet Model
In this machine learning project, you will learn how to load, fine tune and evaluate various transformer models for text classification tasks.

Deep Learning Project for Beginners with Source Code Part 1
Learn to implement deep neural networks in Python .

ML Model Deployment on AWS for Customer Churn Prediction
MLOps Project-Deploy Machine Learning Model to Production Python on AWS for Customer Churn Prediction

Learn to Build an End-to-End Machine Learning Pipeline - Part 1
In this Machine Learning Project, you will learn how to build an end-to-end machine learning pipeline for predicting truck delays, addressing a major challenge in the logistics industry.