Stack Exchange Network

Stack Exchange network consists of 175 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
16 views

Placing constraints on linear model coefficients

I have this bit of data : ...
0
votes
0answers
20 views

Calculate coefficients in multiple regression

I have a model where tree height is a function of diameter and species type. (Tree height)^n= a0+ a1*Diameter+ a2*Type I would like to calculate the coefficients ...
1
vote
0answers
10 views

Predicting values in a data frame using appropriate log-logistic model

I am supposed to predict the concentration values (conc) for control and treat group in the column in the data frame, ref values should stay the same. ...
1
vote
0answers
34 views

Linear model for paired data [closed]

We have 100 subjects of varying and known age and sex with two strongly related dependent variables (X, Z) measured with two methods (A and B). Method B is known and expected to show more reduced ...
1
vote
1answer
33 views

Its my model a Mixed model?

I am running some analysis with mixed model with R. I get differents measures from differents persons (person as random effect), during this analysis and looking plots for each people vs measures I ...
0
votes
0answers
43 views

How to read lm() plots for models with factors

I'm trying to get a handle on how to read the Residuals vs Fitted and Scale-Location plots of lm() objects when the predictors are a mix of continuous and factor ...
10
votes
1answer
241 views

Repeated measures anova: lm vs lmer

I'm trying to reproduce several interaction test between with both lm and lmer on repeated measures (2x2x2). The reason I want ...
1
vote
0answers
44 views

Correct R formula syntax for lm (or manyglm) for a hierachial experimental design

I have an experimental data set where there are a 16 fish in 4 tanks (64 fish). There are two treatments - Heated and Control and four tanks. Heated was done in tank 1 and 2 whilst Control in Tank 3 ...
1
vote
3answers
42 views

When transform variables to int or to ordinal variables to compute a linear regression model in R?

I am working in R with a database that contains variables as seasons, months, days, temperature, humidity and cnt (integer values). I want to compute a linear model using cnt as the dependent variable ...
0
votes
0answers
18 views

Single model with unique intercept and slope for each observation

I'm trying to use R to generate a linear model with a unique intercept and slope for each observation - effectively, a single linear model for each observation but contained within a single lm object. ...
1
vote
1answer
47 views

Using a given polynomial formula in a lm() model in R

I am currently trying to fit a polynomial model to measurement data using the lm() function. fit_poly4 <- lm(y ~ poly(x, degree = 4, raw = T), weights = w) ...
0
votes
0answers
23 views

How to test zero hypothesis with a linear model lm

I would like to test a zero hypothesis on a linear model in R ( H0: F = 0, H1: F/= 0). How do I do it? Is it adequate to just use a linear model and if its not significant, then H0 is true? My Code ...
0
votes
0answers
23 views

Repeated measures ANOVA in R (split-split-plot design)

I am trying to fit a repeated measures ANOVA from an experiment with a split-split-plot design and several measures over time. The experimental design is as follows: I have 9 blocks in the field. ...
0
votes
1answer
53 views

Can eta squared be used for comparing effect size of a categorical (>2 categories) and continuous variable?

I have a linear model with both continuous and categorical (>2 categories) variables. I am aware of other statistics (e.g., AIC sum of weights and lmg from R package relaimpo) that can be used to ...
2
votes
0answers
37 views

How to construct a scatterplot with regression line that adjusts for other covariates?

I am attempting to produce a scatterplot with a regression line whose intercept & slope are adjusted to account for another covariate in the model. (I understand that the data points don't change, ...
1
vote
0answers
39 views

extract distribution of y for point x given lm of y~x

If I have two variables x and y that have a linear relationship e.g. using data from the mtcars package and R code ...
0
votes
0answers
18 views

Stats for habitat preferences

I have what I think is a three level contingency table, with time spent in three habitats for two species, and whether their 'condition' was in the presence of a competitor species or not. example ...
0
votes
0answers
20 views

model diagnostic using plot(model) in r: return the suspicious values

plot(model) gives us a number of diagnostic plots with regards to the model we build. In these plots, if there are suspicious values (values which might decrease model performance), their index is ...
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
70 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
84 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
35 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
44 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
534 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
1answer
65 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
41 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
41 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
170 views

partial correlation from lm model

I'm trying to calculate partial correlations from lm ...
0
votes
0answers
67 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
38 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
155 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
55 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
317 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
29 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
669 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
273 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
101 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
31 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
25 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
183 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
86 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
466 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
18 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
45 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
32 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
196 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
148 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
44 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
40 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 <...