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.

Force certain parameters to have positive coefficients in lm()

I would like to know how to constrain certain parameters in lm() to have positive coefficients. There are a few …

r regression linear-regression glm lm
Is there a faster lm function

I would like to get the slope of a linear regression fit for 1M separate data sets (1M * 50 rows for …

r lm
Applying lm() and predict() to multiple columns in a data frame

I have an example dataset below. train<-data.frame(x1 = c(4,5,6,4,3,5), x2 = c(4,2,4,0,5,4), x3 = c(1,1,1,0,0,1), x4 = c(1,0,1,1,0,0), x5 = c(0,0,0,1,1,1)) …

r regression linear-regression lm mlm
R: predict.lm() not recognizing an object

> reg.len <- lm(chao1.ave ~ lg.std.len, b.div) # b.div is my data frame imported …

r linear-regression lm predict
How to interpret lm() coefficient estimates when using bs() function for splines

I'm using a set of points which go from (-5,5) to (0,0) and (5,5) in a "symmetric V-shape". I'm fitting a model …

r regression lm spline bspline
Cluster-Robust Standard Errors in Stargazer

Does anyone know how to get stargazer to display clustered SEs for lm models? (And the corresponding F-test?) If possible, …

r lm stargazer standard-error
How to update summary when using NeweyWest?

I am using NeweyWest standard errors to correct my lm() / dynlm() output. E.g.: fit1<-dynlm(depvar~covariate1+covariate2) …

r summary lm
How to use formula in R to exclude main effect but retain interaction

I do not want main effect because it is collinear with a finer factor fixed effect, so it is annoying …

r regression linear-regression lm categorical-data
lm called from inside dlply throws "0 (non-NA) cases" error [r]

I'm using dlply() with a custom function that averages slopes of lm() fits on data that contain some NA values, …

r plyr lm
lm() Regression with interactions for an entire dataframe

I know there is a shortcut in Rto run an lm()regression on all a dataframe like this : reg<…

r regression lm