How to reference lm function in R? Hopefully a quick and easy question for somebody on here. I'm a masters student using R to interpret data for my thesis. I want to reference the type of linear regression that I have used in my analysis, e.g. Pearson correlation coefficient detected no significant...etc etc etc. I am using the lm function in R but I can't find any information on the regression model that this function uses.
My question is - how do I reference the lm function for my thesis?
Or to put it another way - what model is used in the lm function?
Thank you :)
 A: The usual convention is to reference the package the function is published in.  The function lm is published in the stats package, but this package is part of base R and was designed by the core team, so in this particular case you should just cite the R program directly.  The current citation is:

R Core Team (2021). R: A language and environment for statistical
computing. R Foundation for Statistical Computing, Vienna, Austria.
URL https://www.R-project.org/

A: This function fits ordinary least squares linear regression, often just called OLS. The goal of OLS is to find the predictions, generated by some linear combination of parameters, that minimizes a particular quantification of error where we square the distance between predictions and observations and then add up those squared values.
OLS seeks to find the $\hat\beta$ parameters giving the best $\hat y$ predictions, in terms of this sum of squares, for the following equation:
$$
\hat y =\hat\beta_0 + \hat\beta_1 x_1 +\dots +\hat\beta_p x_p
$$
Here, the $x_k$ are the features you input into the function.
There are a number of appealing properties of this particular quantification of error (there are many other options) that are covered elsewhere on Cross Validated. Among the appealing properties is the relationship to Gaussian-distributed error terms (the details of which go beyond the scope of where I want to keep this reply, but the short version is that minimizing this sum of squares is equivalent to maximum likelihood estimation when the errors are Gaussian).
