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.

Filter by
Sorted by
Tagged with
1
vote
1answer
40 views

Statistics help! Reporting ANOVA results!

I am new to statistics and I need some help in understanding how to report the data of some tests I am running on R, I hope this is the right place! I have a dataset: ...
0
votes
0answers
28 views

Limit the upper predicted values in r

I'm trying to predict rainfall. But the log model gives very high prediction for certain values. Please check the plot for actual vs predicted values. Is it possible to limit/restrict the upper ...
2
votes
1answer
20 views

Regression with paired, repeated measures design

I have a large population of books. Each book is either a hardback or softback (thus hardback and softback books are paired with one another by title), and can fall into two categorical genres - ...
0
votes
1answer
27 views

Comparing multiple lm results created in ggplot2 [closed]

I have the following example plot: Created via: ...
0
votes
1answer
39 views

Regression: Why does using quadratic expressions work with linear estimators? [duplicate]

My questions is, that I see people using R´s lm() (linear regression model) with Y ~ X^2 e.g. here: Simple non-linear regression problem But I dont see how and ...
0
votes
0answers
68 views

HELP: LM shows no relationship, but LMM does

My research question is assessing if a variable (let’s call it ‘x') can predict another variable (let’s call it ‘y’). The two variables x and y are in the same units, but they just come from ...
4
votes
2answers
69 views

Calculate the intercept from lm

I would like to understand how I can compute by hand the intercept from lm. The following example is a fractional factorial design (3^3) and the variables are factors. ...
2
votes
0answers
26 views

R - Interpretation of coefficients and written form of fitted model in lm() linear regression when using poly()

I've tried reading several resources on poly(), I'm not able to see an answer to my question. My question pertains how I might present my fitted linear model in a way that the coefficients are ...
0
votes
1answer
29 views

question about lm function in R

I have a simple question to ask regarding the lm function (and linear models in general). I am trying to predict y based on x, z, and a x*z interaction. If I simply predict y based on x I get the ...
8
votes
0answers
157 views

Why is the type I error (power?!) for shapiro.test on studentized residuals on lm is 10% and for regular residuals is just 5%?

I understand that the residuals from a regression model are not i.i.d. Hence, checking if they are normal (even when we know it is the case), should be a problem since they are dependent. The ...
0
votes
0answers
10 views

Post Hoc Tests with a lm model where model assumptions are violated

I have the following data set: dependent variable is carbon levels in manure. Independent varibale is the month that the manure was collected in (12 level factor). I want to test if there is a ...
0
votes
1answer
17 views

Placing constraints on linear model coefficients

I have this bit of data : ...
0
votes
0answers
25 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
11 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
38 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
34 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
48 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
256 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
63 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
49 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
79 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
40 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
88 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
41 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
42 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
20 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
21 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
72 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
100 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
45 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
986 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
68 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
46 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
43 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
219 views

partial correlation from lm model

I'm trying to calculate partial correlations from lm ...
0
votes
0answers
100 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 ...
2
votes
0answers
173 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
57 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
363 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
30 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
848 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
333 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
120 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
26 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 ...