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

Ray han

Tech Leader | Stanford / Yale University
linkedin profile url

I think that they are fantastic. I attended Yale and Stanford and have worked at Honeywell,Oracle, and Arthur Andersen(Accenture) in the US. I have taken Big Data and Hadoop,NoSQL, Spark, Hadoop... Read More

Relevant Projects

Build Regression Models in Python for House Price Prediction
In this Machine Learning Regression project, you will build and evaluate various regression models in Python for house price prediction.

MLOps using Azure Devops to Deploy a Classification Model
In this MLOps Azure project, you will learn how to deploy a classification machine learning model to predict the customer's license status on Azure through scalable CI/CD ML pipelines.

Recommender System Machine Learning Project for Beginners-1
Recommender System Machine Learning Project for Beginners - Learn how to design, implement and train a rule-based recommender system in Python

Abstractive Text Summarization using Transformers-BART Model
Deep Learning Project to implement an Abstractive Text Summarizer using Google's Transformers-BART Model to generate news article headlines.

Build Portfolio Optimization Machine Learning Models in R
Machine Learning Project for Financial Risk Modelling and Portfolio Optimization with R- Build a machine learning model in R to develop a strategy for building a portfolio for maximized returns.

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.

Build a Collaborative Filtering Recommender System in Python
Use the Amazon Reviews/Ratings dataset of 2 Million records to build a recommender system using memory-based collaborative filtering in Python.

MLOps Project on GCP using Kubeflow for Model Deployment
MLOps using Kubeflow on GCP - Build and deploy a deep learning model on Google Cloud Platform using Kubeflow pipelines in Python

Deep Learning Project for Text Detection in Images using Python
CV2 Text Detection Code for Images using Python -Build a CRNN deep learning model to predict the single-line text in a given image.

Build a Logistic Regression Model in Python from Scratch
Regression project to implement logistic regression in python from scratch on streaming app data.