Quantcast
Channel: Active questions tagged lm - Stack Overflow
Browsing all 124 articles
Browse latest View live

Subset rows within one predictor in GLM without disturb other

I fit parasitoid abundance to two factors, flower availability and distance of the crop to flower.Firstly, I fit separate glm equation:glm(abundance ~ flower, data = data, family =...

View Article


Trying to fit a submodel, What do I do wrong?

lm_full <- lm(CO ~ AT + AP + AH + GTEP + TIT + TAT + TEY, data = Data)lm_modelA <- lm(CO ~ AT + AP + AH, data = Data)returns this error message:i as.data.frame.default(data) :cannot coerce class...

View Article


Interpreting results with a cox test [migrated]

I am trying to compare 2 non nested models using coxtest from lmtest library. Lamentably I can not find some explanation about the results from this test.My first goal was use anova(model1, model2) to...

View Article

Adding lagged variables to an lm model?

I'm using lm on a time series, which works quite well actually, and it's super super fast.Let's say my model is:> formula <- y ~ xI train this on a training set:> train <- data.frame( x =...

View Article

can I recreate output of uecm of the best auto_ardl model using dynlm

Can you guys please help me find the reasoning whether I can use dynlm package to recreate a uecm model extracted from ARDL package? and if I could, why the summary produced is very different. Can I...

View Article


Value-added Plots for models estimated by plm-package in r?

If I estimated my model using the lm-function, I would be able to create Value-Added Plots typing the following code:ols_model <- lm( log(y) ~ log(x1) + log(x2) + log(x3), data =...

View Article

Image may be NSFW.
Clik here to view.

Value-added Plots for models estimated by plm-package in r and interpretation?

If I estimated my model using the lm-function, I would be able to create Value-Added Plots typing the following code:ols_model <- lm( log(y) ~ log(x1) + log(x2) + log(x3), data =...

View Article

Contrasts from lm in R

I have data where I want to compare the level of a factor with the mean of another level of that factor. In addition, I want to create this contrast for all levels of another factor.So I want to get a...

View Article


Image may be NSFW.
Clik here to view.

What is a good starting model for fitting a rotated sigmoidal curve? [migrated]

I'm trying to make a model to fit a rotated sigmoidal curve in R but don't know where to start when looking for an appropriate equation for the model.Some example data and the type of fit I'm getting...

View Article


How to get coefficient values for all treatments in a zero-intercept lm model

(edited to include two instead of one categorical variable)I have a hypothetical dataset with two categorical variables, 4 mutually exclusive treatments and 5 mutually exclusive groups, and a...

View Article

Predicting using an exponential model

I have the following data:Days Total cases1 32 33 54 65 286 307 318 349 3910 4811 6312 7013 8214 9115 10716 11217 12718 14619 17120 19821 25822 33423 40324 49725 57126 65727 73028 88329 102430 113931...

View Article

Way to extract data from lm-object before function is applied?

let me directly dive into an example to show my problem: rm(list=ls()) n <- 100 df <- data.frame(y=rnorm(n), x1=rnorm(n), x2=rnorm(n) ) fm <- lm(y ~ x1 + poly(x2, 2), data=df)Now, I would like...

View Article

estimatr::lm_robust() estimating different coefficients from lm()

After running a panel model (5475 units, 13 years) with stats::lm(), I've been trying to estimate heteroskedasticity robust standard errors with estimatr::lm_robust(). It turns out that some...

View Article


Convert two-tailed p-values to one-tailed p-values in lm and glm output (and...

THIS IS A PROGRAMMING QUESTION; ADMINS CLEARLY HAVEN'T READ THE QUESTION BEFORE CLOSING IT. I'M STILL KEEN TO HEAR PEOPLE'S THOUGHTS ON POSSIBLE SOLUTIONS. THANK YOU!Say I have the following...

View Article

Why does my fe with demeaned data ( lm() ) not reproduce coefficients from...

I am trying to reproduce fixed effects coefficients for panel data using different packages and techniques: (1) plm(), (2) lfe(), (3) dummy-lsdv with lm(), and (4) demeaned-fe with lm().My data set...

View Article


How can I fix coefplot() error "need finite 'ylim' values"

I'm not 100% sure this is a coding issue, let me know.I'm trying to plot the coefficients of this DiD model using fake data, but I'm not savvy enough to know if it's a problem coefplot() or if it's...

View Article

Loop over multiple regressions to store clustered standard errors [closed]

I need a loop to generate the clustered std. errors for several lm-s. The models are named m1_1 …m1_7. To export the results with stargazer I need a vector with the clustered std. errors for every...

View Article


Changing variable names in a plot - SJplot

I am trying to change the variable names in a plot to make them more intuitive.For example, in the replicable example below I am tryimng to change "cyl" to the "Number of cylinders"`...

View Article

mutate() error - Index 1 must have length 1, not 13

My goal is to show multiple plots of residual vs. fitted values for a dataframe of 13 stations each having a separate lm() model. Working from an example in Chapter 25 (Many Models) in the R for Data...

View Article

cLDA constraint for discrete-time models in R formulas

I work with longitudinal (repeated measures) models of clinical trial data. Patients are randomized to different treatment groups and measured over multiple pre-specified points in time. An example...

View Article
Browsing all 124 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>