Top "Lm" questions

The lm function is used to fit linear models in R. It can be used to carry out regression, single stratum analysis of variance and analysis of covariance.

How can I plot the residuals of lm() with ggplot?

I would like to have a nice plot about residuals I got from an lm() model. Currently I use plot(…

r ggplot2 lm
Linear Regression and storing results in data frame

I am running a linear regression on some variables in a data frame. I'd like to be able to subset …

r linear-regression lm
warning when calculating predicted values

working with a data frame x Date Val 1/1/2012 7 2/1/2012 9 3/1/2012 20 4/1/2012 24 5/1/2012 50 a <- seq(as.Date(tail(x, 1)$Date), by="month", length=5) …

r lm predict
Linear model (lm) when dependent variable is a factor/categorical variable?

I want to do linear regression with the lm function. My dependent variable is a factor called AccountStatus: 1:0 days in …

r lm categorical-data r-factor
How to manually set coefficients for variables in linear model?

In R, how can I set weights for particular variables and not observations in lm() function? Context is as follows. …

r linear-regression lm
How does the subset argument work in the lm() function?

I have been trying to figure out how the subset argument in R's lm() function works. Especially the follwoing code …

r linear-regression lm
Using column numbers not names in lm()

Instead of something like lm(bp~height+age, data=mydata) I would like to specify the columns by number, not …

r formula lm
Obtain residual standard errors of an "mlm" object returned by `lm()`

I've used lm() to fit multiple regression models, for multiple (~1 million) response variables in R. Eg. allModels <- lm(…

r regression linear-regression lm mlm
Extracting PCA axes for further analysis

I am analysing data regarding reed fields. Variables I have measured are water depth, reed height, reed density, etc. As …

r pca lm
Is there a simple command to do leave-one-out cross validation with the lm() function?

Is there a simple command to do leave-one-out cross validation with the lm() function in R? Specifically is there a …

r cross-validation lm