Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [lm]

lm is the name of the linear model (i.e. multiple regression) function in the statistics package R. For linear models in general use the `linear-model` tag instead.

0
votes
1answer
39 views

Which model should I try first?

I think about appropriate modelling technique in the following task: I have news texts (around 50K), and I have news topics made from the texts (250) which have various number of texts that made them ...
0
votes
1answer
47 views

Formula used in confidence intervalle on R's lm function

Does someone know how confidence interval on factor values are computed on R (lm function), here is a simple example : data ...
0
votes
1answer
59 views

Confidence interval in R lm function with factors values

Does lm R function handle factors value 'correctly' when computing confidence interval ? I read that confidence interval formula are different in case of discrete or continuous variable. Thanks. ...
1
vote
0answers
34 views

Computation of R-squared with lm() in R [duplicate]

Confusion on difference between the $R^2$ results from the lm() function in R and from the Equation $1-rss/sst$ (1) Ref: https://onlinecourses.science.psu....
1
vote
0answers
43 views

Fitting a multiple linear regression in R [closed]

I have annual mean temperature and precipitation data from 1901 to 2015: I want to do a multiple linear regression: ...
0
votes
1answer
25 views

Getting equation for lm/ggplot geom smooth with multiple levels [closed]

I'm trying to get equations for slope intercept for an lm with a three level categorical variable and a continuous covariate. Essentially I have plotted these using ggplot and in the legend I would ...
0
votes
0answers
16 views

Interaction between categorical and continuous variable

In my dataset, I have to test the effect of humidity on the height of plants. However, we have an extra effect which is nitrate on height. Each plant had a nitrate measurement but we had one group in "...
0
votes
1answer
45 views

Multiple Regression in R with y as a Factor

I have a data set that rates customer satisfaction based on three options: Recommend Neutral Not satisfied I understand those may not be the best options but that's what I have to work with. Another ...
0
votes
1answer
30 views

Build multiple regression model with Y as a Factor in R [duplicate]

I have a data set that rates customer satisfaction based on three options: Recommend Neutral Not satisfied I understand those may not be the best options but that's what I have to work with. ...
1
vote
2answers
32 views

LM Model Assumptions: Transforming Data in R using log()

I have a dataset in which I am trying to fit a model for: model <- lm(expression_fold~distance, data = pairwise_sub) However the data set is heteroscedastic, ...
0
votes
0answers
36 views

partial correlation from lm model

I'm trying to calculate partial correlations from lm ...
0
votes
0answers
19 views

better NLS algorithm. Port or LM?

so I've had to choose between Port and LM for a non-linear regression. Initially, on the first 60 datasets, Port solved all (with bounded limits), LM chocked on one and the other 59 results were the ...
0
votes
1answer
37 views

Linear mixed effect models - Why is time specific variance under estimated?

Suppose you fit a linear mixed effect model $$y_{ij} = \mu + \beta^T x_{ij} + u_i + \epsilon_{ij}$$ where $u_i \sim N(0,\sigma^2)$ and $\epsilon_{ij} \sim N(0,\nu^2)$. I have noticed that when ...
1
vote
0answers
70 views

Fast way to obtain SSR (Sum of Squares residuals) from QR in least square model?

I am using a linear regression, yet the only output I need is the Sum of Squared Residuals (SSR), I don't care about the coefficients. (Context is a non-linear LS, which is linear given an extra ...
1
vote
2answers
45 views

Significant main effects lost during ANCOVA due to interaction terms. Is type III the way to go?

I have some experimental data which I am analysing using step wise multiple regression (ANCOVA) in R using the step function. The response data (wp) is the leaf ...
2
votes
2answers
213 views

Extract linear equations from R's lm

Assume I have data with a dependency y(t) and parameters p1, p2 and ...
1
vote
0answers
26 views

How to get specific terms of a polynomial function in a regression?

I want to simplify data from a complex modell like: fit <- lm(z ~ poly(a,4)*poly(b,5)*poly(c,6), data = somewhat) As I don't know which terms of the complete ...
1
vote
1answer
193 views

Interpreting the standard error from emmeans - R

I am using the emmeans package to run post-hoc analysis on linear mixed models. The results provide what I would expect except for the standard error. I run the ...
1
vote
0answers
97 views

Robust regression - differences in approach (rlm and lmrob)?

I am looking to implement robust regression in R for large data (n=~500,000). The two options that come up are lmrob and rlm. ...
1
vote
0answers
61 views

Robust regression with Sandwich estimator

I understand that rlm (robust regression) addresses issues of outliers and influential observations, but does not address heteroskedasticity. I have come to learn ...
0
votes
1answer
27 views

What is the difference between the estimation technique used for `ARIMA()` and for `lm()` in R?

Does anyone have an idea on this? In R, for arima(), I do the following: arima(ts.GDP, order = c(3,0,0), seasonal = c(0,0,0)) ...
1
vote
0answers
23 views

Should I lag explanatory variables in regression with apparently strong predictive relationship?

I'm no expert when it comes to statistics (learning though) and I am working on developing a multiple linear regression model in an attempt to forecast sales revenue. I feel like I may have developed ...
1
vote
0answers
91 views

Are the standard errors produced by R's plm package for weighted models reliable?

I have a strong feeling there is a bug in R's plm package when it comes to the standard errors of weighted models. I have noticed that the standard errors are not ...
0
votes
0answers
48 views

Using fit.models() or alternative to compare rlm and lm model

I want to compare lm and rlm models. rlm() does not provide element such as R-squared to compare to lm(). I use the following code to get explanatory variables from both models. ...
0
votes
1answer
254 views

residual normality test in R [duplicate]

if I run the lm in R, after getting the results, can I find out the normality of the residual? or I need to run another test such as qqline? here is the example: In other words, what does the last ...
0
votes
0answers
15 views

Interpretation of log log model [duplicate]

I have following equation that i working with log(y)=1+log(x1)+log(x2)+Dummyvar(0/1)+error My question is how do we interpret coefficient of Dummy variable? In ...
0
votes
0answers
20 views

reporting means and standard errors of multiple categories based on lm output

Lets say I have a variable that I model based on two categorical predictors. Here is code to generate data in R: ...
-1
votes
3answers
23 views

Is that possible in some cases linear regression perform better than complex non-linear methods such as RF, ANN,

is there any reason for simple linear regression to perform better compare to nonlinear models such as RF,cubist and ann? i have a data set which using linear regression gives better performance ...
1
vote
1answer
30 views

Validity of method for Identifying effect of a class on quantitative variable

I'd like to know if a method I'm trying to use for analysis is valid (statistically speaking). Here's the deal : My dataset has a few quantitative variables and I'm trying to see if a qualitative ...
0
votes
1answer
165 views

Why does Prediction Interval of lm function in R Return a Static Interval

I am looking for a simple method that will capture the relationship between predictor variables and the variance of the outcome. As a simple reproducible example consider this code where I ...
3
votes
1answer
111 views

Crossed vs. Nested Design in R

I am trying to do an experiment where I use three treatments to make the tallest popovers. The three treatments are: using refrigerated eggs/milk versus room temperature eggs/milk mixing the batter ...
1
vote
0answers
20 views

How may I estimate means and SE for an ANCOVA model fitted on multiply imputeted data with mice?

As I have incomplete data I used mice() for multiply impute missing data and then I want to perform an ANCOVA. In the end what I want to get is the means and ...
0
votes
0answers
38 views

95% CI interpretation on transformed data using (abs(x-mean(x)))

I have a problem for which no search has provided an answer. I am using lm() to build a model which I tested to ensure it met all assumptions using the following <...
1
vote
0answers
79 views

Contradictory results from comparing standardized and unstandardized Coefficients in a log-level regression

I am analysing a dataset using a log-level regression in R. My two key variables of interest are called MTenure and CTenure. Both are significant and the respective unstandardised coefficients are 2....
1
vote
1answer
1k views

“2 not defined because of singularities”

I'm new when it comes to regressions, and I really need help with a regression in connection with a school assignment, and I've tried to google this problem here, but I cant really find the answer to ...
1
vote
1answer
438 views

Results of lm() function with a dependent ordered categorical variable?

I am trying to understand Ben Bolker's answer to this question. First, we create a data frame: ...
0
votes
0answers
81 views

Satterthwaite, Kenward-Roger approximations or pooled variances for linear non-mixed models in R

I have heteroscedasticity issues in my data set. I have no mixed effects that apply, so this is just a linear model (normal distribution, identity link). I know how to apply K-R and Satterthwaite's ...
0
votes
1answer
562 views

85% Bonferroni family-wide (simultaneous) CI for lm in R

The code confint(model, level = 1 -0.15/length(coef(model))) was recommended by https://stat.ethz.ch/pipermail/r-help/2005-March/067570.html However, I have ...
0
votes
2answers
266 views

Is the variation in the residual standard deviation (on sample) accounted for when one builds a prediction interval (PI)?

This question is somehow related to Is the residual, e, an estimator of the error, $\epsilon$? I also found some information here: Confidence interval of RMSE Let's say, I got a model that explains ...
0
votes
0answers
73 views

lm in R: What's better? “ugly” model with high $R^2$ or a “beautiful” one with worse $R$? How much VIF is too much?

I have been trying to model with lm in R. I have several variables: Initial cell concentration $(X1)$, macroscopic appearance $(X2, X3, X4, X5)$, microscopic appearance $(X6,X7,X8)$, % of cells moving ...
0
votes
1answer
253 views

Boxplot GLM with binomial errors - interpret summary

My apologies, I am not even sure how to phrase this question clearly. I am essential trying to get meaningful statistics to present tomorrow. All I have managed is this. However, I am very confused ...
0
votes
0answers
79 views

Plotting the influence of the second factor after excluding the influence of the first factor [R, lm(), lmer()]

I am conducting regression analysis and multilevel modeling in R using lme4 package. I would like to plot the influence of ...
0
votes
0answers
44 views

Find some values lm with only TSS

I have this lm output: ...
0
votes
2answers
57 views

Build a single lm() model from hundreds of stores in R?

I’ve built many lm() models in R, but this is a new challenge. I have 100s of independent stores as objects. Each stores has simple 2 column time series (1 X and 1 Y). Very simple! I want to ...
0
votes
0answers
28 views

How to get a likelihood funciton, Wald estimate, and LM estimate?

The question is ... Assume the following model, $$y_i= \theta+\epsilon_i$$ For every $i, \epsilon_i$ has same distributions and its density is, $$p(\epsilon_i) = \theta I(\epsilon_i = 1-\theta) + (...
1
vote
1answer
126 views

LMM with standardized predictor - how to retrieve intercept & slope in the original scale

I fitted a LMM with random intercept and random slope by means of lmer(): model <- lmer(y ~ x + (1+x|subject),df) However, lmer() returned an error: ...
2
votes
1answer
1k views

Interpreting R lm() output with factor as variable

Hi everyone: I'm hoping for some conceptual and practical advice when it comes to statistical analysis using linear models. The overview is this: I have values measured from 4 trials, each of which ...
0
votes
1answer
213 views

p value for the last level using lm with contrast sum in R

How do I get the p-value for the last level in a categorical variable from a linear regression model in R when contrast is set to contr.sum ...
-1
votes
3answers
962 views

Plotting the results of linear regression model using ggplot2 - interpretation

I have only recently learnt how to undertake a regression analysis in R. I was wondering whether someone could help me in interpreting what my ggplot result shows below?