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 Fitting Linear Models to the Data Set in R Programming - glm() 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 an extension of linear regression where the relationship between the dependent variable (y) and the independent variable (x) is modeled as an nth degree polynomial.Equation: y = \beta_0 + \beta_1 x + \beta_2 x^2 + \ldots + \beta_n x^n + \varepsilony: Predicted output (depend 3 min read Regression and its Types in R Programming Regression analysis is a statistical tool to estimate the relationship between two or more variables. There is always one response variable and one or more predictor variables. Regression analysis is widely used to fit the data accordingly and further, predicting the data for forecasting. It helps b 5 min read Poisson Regression in R Programming A Poisson Regression model is used to model count data and model response variables (Y-values) that are counts. It shows which X-values work on the Y-value and more categorically, it counts data: discrete data with non-negative integer values that count something. In other words, it shows which expl 2 min read Like