SlideShare a Scribd company logo
Swipe
R - Linear Regression
Regression analysis is a very widely used
statistical tool to establish a relationship model
between two variables.
One of these variable is called predictor variable
whose value is gathered through experiments.
The other variable is called response variable
whose value is derived from the predictor variable
In Linear Regression these two variables are
related through an equation, where exponent
(power) of both these variables is 1.
R - Vectors
Mathematically a linear relationship represents a
straight line when plotted as a graph.
A non-linear relationship where the exponent of
any variable is not equal to 1 creates a curve.
The general mathematical equation for a linear
regression is:-
y = ax + b
Following is the description of the parameters
used:-
y is the response variable.
x is the predictor variable.
a and b are constants which are called the
coefficients.
Steps to Establish a Regression
A simple example of regression is predicting
weight of a person when his height is known.
To do this we need to have the relationship
between height and weight of a person.
The steps to create the relationship is:-
Carry out the experiment of gathering a
sample of observed values of height and
corresponding weight.
Create a relationship model using the lm()
functions in R.
Find the coefficients from the model created
and create the mathematical equation using
these
Get a summary of the relationship model to
know the average error in prediction. Also
called residuals.
To predict the weight of new persons, use the
predict() function in R.
lm() Function
This function creates the relationship model
between the predictor and the response variable.
The basic syntax for lm() function in linear
regression is:-
lm(formula,data)
Following is the description of the parameters
used −
formula is a symbol presenting the relation
between x and y.
data is the vector on which the formula will be
applied.
predict() Function
The basic syntax for predict() in linear regression
is:-
predict(object, newdata)
Following is the description of the parameters
used −
object is the formula which is already created
using the lm() function.
newdata is the vector containing the new
value for predictor variable.
R - Multiple Regression
R - Logistic Regression
R - Normal Distribution
Stay Tuned with
Topics for next Post

More Related Content

PDF
Linear regression
PPTX
Simple linear regression
PDF
Regression analysis in excel
PDF
Regression analysis algorithm
PPTX
Econometrics chapter 8
PPTX
Machine Learning-Linear regression
PPTX
Polynomial regression
PPTX
Regression
Linear regression
Simple linear regression
Regression analysis in excel
Regression analysis algorithm
Econometrics chapter 8
Machine Learning-Linear regression
Polynomial regression
Regression

What's hot (18)

PPT
Math n Statistic
PPTX
Regression Analysis
PPTX
Regression Analysis
PDF
Regression: A skin-deep dive
PDF
Use of Linear Regression in Machine Learning for Ranking
PPT
10685 6.1 multivar_mr_srm bm i
PPTX
Logarithmic transformations
PPTX
Transformation of variables
PPTX
Regression & It's Types
PPTX
Regression analysis by akanksha Bali
PPT
Sumit presentation
PPTX
Further8 data transformation
PPT
Computing Transformations Spring2005
PPT
Lecture 4
PPSX
Lasso and ridge regression
PPTX
Differential calculus
PDF
Scatter diagram
PDF
Calculus
Math n Statistic
Regression Analysis
Regression Analysis
Regression: A skin-deep dive
Use of Linear Regression in Machine Learning for Ranking
10685 6.1 multivar_mr_srm bm i
Logarithmic transformations
Transformation of variables
Regression & It's Types
Regression analysis by akanksha Bali
Sumit presentation
Further8 data transformation
Computing Transformations Spring2005
Lecture 4
Lasso and ridge regression
Differential calculus
Scatter diagram
Calculus
Ad

Similar to R linear regression (20)

PPTX
DataScienceUsingR-Dr.P.Rajesh.PRESENTATION
PPTX
Linear Regression.pptx
PPTX
Regression of research methodlogyyy.pptx
PPTX
Linear regression.pptx
PPTX
An Introduction to Regression Models: Linear and Logistic approaches
PPTX
R Bootcamp Day 3 Part 1 - Statistics in R
PPTX
Regression Analysis
PDF
Lecture 1.pdf
PDF
MachineLearning_Unit-II.FHDGFHJKpptx.pdf
PDF
R - Multiple Regression
PPTX
presentation on R language Regression in R
PPTX
Regression (Linear Regression and Logistic Regression) by Akanksha Bali
PPTX
MachineLearning_Unit-II.pptxScrum.pptxAgile Model.pptxAgile Model.pptxAgile M...
PPTX
Predicating continuous variables-1.pptx
PDF
Linear regression model in econometrics undergraduate
PDF
Regression analysis
PPTX
simple and multiple linear Regression. (1).pptx
PPTX
regression analysis presentation slides.
PDF
R Regression Models with Zelig
PPTX
regression.pptx
DataScienceUsingR-Dr.P.Rajesh.PRESENTATION
Linear Regression.pptx
Regression of research methodlogyyy.pptx
Linear regression.pptx
An Introduction to Regression Models: Linear and Logistic approaches
R Bootcamp Day 3 Part 1 - Statistics in R
Regression Analysis
Lecture 1.pdf
MachineLearning_Unit-II.FHDGFHJKpptx.pdf
R - Multiple Regression
presentation on R language Regression in R
Regression (Linear Regression and Logistic Regression) by Akanksha Bali
MachineLearning_Unit-II.pptxScrum.pptxAgile Model.pptxAgile Model.pptxAgile M...
Predicating continuous variables-1.pptx
Linear regression model in econometrics undergraduate
Regression analysis
simple and multiple linear Regression. (1).pptx
regression analysis presentation slides.
R Regression Models with Zelig
regression.pptx
Ad

More from Learnbay Datascience (20)

PDF
Top data science projects
PDF
Python my SQL - create table
PDF
Python my SQL - create database
PDF
Python my sql database connection
PDF
Python - mySOL
PDF
AI - Issues and Terminology
PDF
AI - Fuzzy Logic Systems
PDF
AI - working of an ns
PDF
Artificial Intelligence- Neural Networks
PDF
AI - Robotics
PDF
Applications of expert system
PDF
Components of expert systems
PDF
Artificial intelligence - expert systems
PDF
AI - natural language processing
PDF
Ai popular search algorithms
PDF
AI - Agents & Environments
PDF
Artificial intelligence - research areas
PDF
Artificial intelligence composed
PDF
Artificial intelligence intelligent systems
PDF
Applications of ai
Top data science projects
Python my SQL - create table
Python my SQL - create database
Python my sql database connection
Python - mySOL
AI - Issues and Terminology
AI - Fuzzy Logic Systems
AI - working of an ns
Artificial Intelligence- Neural Networks
AI - Robotics
Applications of expert system
Components of expert systems
Artificial intelligence - expert systems
AI - natural language processing
Ai popular search algorithms
AI - Agents & Environments
Artificial intelligence - research areas
Artificial intelligence composed
Artificial intelligence intelligent systems
Applications of ai

Recently uploaded (20)

PPTX
Lesson notes of climatology university.
PPTX
master seminar digital applications in india
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Computing-Curriculum for Schools in Ghana
PPTX
Cell Types and Its function , kingdom of life
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Complications of Minimal Access Surgery at WLH
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Pre independence Education in Inndia.pdf
PPTX
Pharma ospi slides which help in ospi learning
PPTX
PPH.pptx obstetrics and gynecology in nursing
Lesson notes of climatology university.
master seminar digital applications in india
Abdominal Access Techniques with Prof. Dr. R K Mishra
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
2.FourierTransform-ShortQuestionswithAnswers.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Anesthesia in Laparoscopic Surgery in India
Computing-Curriculum for Schools in Ghana
Cell Types and Its function , kingdom of life
Supply Chain Operations Speaking Notes -ICLT Program
Module 4: Burden of Disease Tutorial Slides S2 2025
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
O7-L3 Supply Chain Operations - ICLT Program
Renaissance Architecture: A Journey from Faith to Humanism
Complications of Minimal Access Surgery at WLH
Microbial disease of the cardiovascular and lymphatic systems
Pre independence Education in Inndia.pdf
Pharma ospi slides which help in ospi learning
PPH.pptx obstetrics and gynecology in nursing

R linear regression

  • 1. Swipe R - Linear Regression
  • 2. Regression analysis is a very widely used statistical tool to establish a relationship model between two variables. One of these variable is called predictor variable whose value is gathered through experiments. The other variable is called response variable whose value is derived from the predictor variable In Linear Regression these two variables are related through an equation, where exponent (power) of both these variables is 1. R - Vectors
  • 3. Mathematically a linear relationship represents a straight line when plotted as a graph. A non-linear relationship where the exponent of any variable is not equal to 1 creates a curve. The general mathematical equation for a linear regression is:- y = ax + b Following is the description of the parameters used:- y is the response variable. x is the predictor variable. a and b are constants which are called the coefficients.
  • 4. Steps to Establish a Regression A simple example of regression is predicting weight of a person when his height is known. To do this we need to have the relationship between height and weight of a person. The steps to create the relationship is:- Carry out the experiment of gathering a sample of observed values of height and corresponding weight. Create a relationship model using the lm() functions in R.
  • 5. Find the coefficients from the model created and create the mathematical equation using these Get a summary of the relationship model to know the average error in prediction. Also called residuals. To predict the weight of new persons, use the predict() function in R.
  • 6. lm() Function This function creates the relationship model between the predictor and the response variable. The basic syntax for lm() function in linear regression is:- lm(formula,data) Following is the description of the parameters used − formula is a symbol presenting the relation between x and y. data is the vector on which the formula will be applied.
  • 7. predict() Function The basic syntax for predict() in linear regression is:- predict(object, newdata) Following is the description of the parameters used − object is the formula which is already created using the lm() function. newdata is the vector containing the new value for predictor variable.
  • 8. R - Multiple Regression R - Logistic Regression R - Normal Distribution Stay Tuned with Topics for next Post