Perform Linear Regression Analysis in R Programming - lm() Function Last Updated : 24 Jun, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report lm() function in R Language is a linear model function, used for linear regression analysis. Syntax: lm(formula) Parameters: formula: model description, such as x ~ y Example 1: Python3 # R program to illustrate # lm function # Creating two vectors x and y x <- c(rep(1:20)) y <- x * 2 # Calling lm() function to # fit a linear model f <- lm(x ~ y) # Getting linear model f Output: Call: lm(formula = x ~ y) Coefficients: (Intercept) y 1.589e-15 5.000e-01 Example 2: Python3 # R program to illustrate # lm function # Creating two vectors x and y x <- c(2, 4, 6, 8) y <- c(1, 3, 5, 7) # Calling lm() function to # fit a linear model f <- lm(y ~ x) # Getting linear model f Output: Call: lm(formula = y ~ x) Coefficients: (Intercept) x -1 1 Comment More infoAdvertise with us Next Article Perform Linear Regression Analysis in R Programming - lm() Function K Kanchan_Ray Follow Improve Article Tags : R Language R Functions R Machine-Learning Similar Reads Regression Analysis in R Programming Regression analysis is a statistical method used to determine the relationship between a dependent variable and one or more independent variables. Regression analysis is commonly used for prediction, forecasting and determining relationships between variables. In R, there are several types of regres 4 min read R-squared Regression Analysis in R Programming For the prediction of one variableâs value(dependent variable) through other variables (independent variables) some models are used that are called regression models. For further calculating the accuracy of this prediction another mathematical tool is used, which is R-squared Regression Analysis or 5 min read Fitting Linear Models to the Data Set in R Programming - glm() Function glm() function in R Language is used to fit linear models to the dataset. Here, glm stands for a generalized linear model. Syntax: glm(formula)Parameters: formula: specified formula  Example 1:  Python3 # R program to illustrate # glm function # R growth of orange trees dataset Orange # Putting a 2 min read Polynomial Regression in R Programming Polynomial Regression is a form of linear regression in which the relationship between the independent variable x and dependent variable y is modeled as an nth degree polynomial. Polynomial regression fits a nonlinear relationship between the value of x and the corresponding conditional mean of y, d 4 min read Decision Tree for Regression in R Programming A decision tree is a machine learning algorithm used to predict continuous values (regression) or categories (classification). In regression, a decision tree is used when the dependent variable is continuous, like predicting car mileage based on engine power.Working of Decision Tree Algorithm of Reg 4 min read Like