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
0 votes
0 answers
44 views

p-values of standardized vs non-standardized regression model coefficients - are they the same?

I made the following simple regression model and used stargazer to output a table that plots the standardized vs non-standardized regression model coefficients. ...
user avatar
1 vote
0 answers
32 views

Effect not significant in lmer which was significant in lm - interpretation

I have a normal linear model (lm(y ~ x + z)) and a linear mixed model (lmer(y ~ x + z + (1|id)). ...
user avatar
1 vote
1 answer
42 views

How do I interpret graphs of residuals to check if the assumptions of lm() / anova() are met?

I need to run a one way ANOVA on some data (water_content) from 3 treatment groups (Water), but am struggling to interpret whether I need to transformation the data to make it appropriate for my lm() ...
user avatar
0 votes
1 answer
50 views

Simulating Data for Factorial Design of Hormone

I am new to simulating data and want feedback on the proposed simulation given the biological relationships I am trying to simulate. Did I make a good model to simulate this data or can it be improved ...
user avatar
0 votes
0 answers
9 views

Examining Interaction Terms in Mixed-effect Modelling

I am very new to LMM and will be appreciated it if I could have your suggestions. I running a study to gauge whether there is an interaction effect among the number of new words in a text (text ...
user avatar
  • 1
1 vote
1 answer
43 views

What does the r-squared and adjusted r-squared value indicate in lm() function in r? [duplicate]

What does the r-squared value indicate in the lm() function in r. How to interprete it with the coefficients and p value. Following is an example of the output i got for summary of linear model I ...
user avatar
0 votes
0 answers
30 views

GLM with inverse-logistic link

Consider a model $$Y = inv.logit(\beta_0 + \beta_1X_1 + \dots, +\beta_dX_d) + \varepsilon,$$ where $inv.logit(x) = \frac{e^x}{1+e^x}$, and $\varepsilon\sim Gumbel$ is a centered Gumbel noice. How can ...
user avatar
0 votes
0 answers
50 views

R lm difference between interactions with category and one models per category [duplicate]

I am analysing a dataset of the performance of several species given an environmental variable. To do so, I use a simple linear model with the lm function from the stats package. Model 1 ...
user avatar
0 votes
0 answers
16 views

Mediation Analysis of cross over test

I used a crossover design to examine the effects of the drug intervention. All subjects participated in two conditions: the drug condition and the placebo condition. The results showed a significant ...
user avatar
0 votes
0 answers
9 views

Best approach to compare trends in timepoint measurements

I have two datasets, a control and experiment. Composed of "activation measurements" of cells(y) on fixed time points with uneven intervals (x). At each time point cells from one batch are ...
user avatar
0 votes
1 answer
74 views

Very high intercept in log-normal linear regression in R

I ran multiple linear regression in R. I have a skewed Y variable and log transforming it gives better results. I didn't transform any of the x variables. Thus, in order to interpret the coefficients ...
user avatar
0 votes
0 answers
40 views

categorical variables longitudinal analysis

I am estimating the predictive capacity of multiple metabolites in different outcomes for a large population that has 3 follow ups. For this I am building linear regression models in two different ...
user avatar
  • 1
1 vote
1 answer
28 views

Developing Leverage Statistics Manually in R

I've asked this question on Stack Overflow but think it might be better here. I currently have the below data frame df with the regression equation ...
user avatar
  • 233
4 votes
0 answers
53 views

Do I control for different effects by adding the variables to the regression?

I'm trying to understand the dynamics of fixed effects in R. Regression without FEs: lm(return ~ esg_score + education, data = df) Do I manage to control for: ...
user avatar
4 votes
3 answers
247 views

correlation vs lm with two predictors

I'm trying to find an equivalent result between cor.test and lm with two predictors. ...
user avatar
  • 905
0 votes
0 answers
14 views

How to find the "inverted" version of a log regression when y is transformed to 100-y (y is a percentage)?

This question is both related to math and coding, and for transparency, I also posted it on Stack Overflow for the coding part. I need to modify a log regression when I change my y-axis data from y to ...
user avatar
  • 101
0 votes
0 answers
153 views

Predict particular value from linear-log (semi-log) regression model using R

I'm having difficulties to properly predict a particular value from a linear regression model with log-transformed x (independent) variable using R. I have a data set that contains measurements of y (...
user avatar
0 votes
2 answers
321 views

How to interpret lm() coefficients when using bs (splines) in R?

I have gone the existing related questions without clarifying my doubt. For the above summary results of a lm() model using bs splines, I would like to fully understand how to interpret the ...
user avatar
  • 1
0 votes
0 answers
97 views

How to calculate R squared and multiple R squared from rlm output?

I have a question that requires me to find and report the adjusted R^2 and multiple R^2 values from a linear regression model. The problem is that the question only tells me to use rlm() from MASS and ...
user avatar
1 vote
1 answer
75 views

How to test whether the relationship between an IV and a DV varies depending on levels of two other variables

Let's say I have 2 different conditions participants can be assigned to (stored in the variable condition). Within each condition...
user avatar
0 votes
1 answer
30 views

How to manually adjust predicted probabilities from lm based on prior lognormal distribution parameters?

@drob showed a great example of adjusting batting averages using a beta-based prior distribution. He used a prior calculated Beta distribution to adjust batting averages individually, and it’s as ...
user avatar
0 votes
0 answers
45 views

Values of reference categories for main and interaction effects using lm() in R [duplicate]

...
user avatar
  • 1
1 vote
0 answers
91 views

VIF (multicollinearity), Breusch-Godfrey (autocorrelation), Breusch-Pagan (heteroskedasticity) for Linear Regression

We are conducting linear regression. We performed first the Variance Inflation Factor to check for multicollinearity and we dropped the independent variables below 10 So are ALL of our independent ...
user avatar
2 votes
0 answers
42 views

Custom contrasts in R: why should I take the generalized inverse of transpose of the original contrast matrix?

Let's say there is a continuous variable y and a grouping (factor) variable x with 3 different levels: ...
user avatar
1 vote
1 answer
107 views

Are my slope and intercept significantly different from 1 and 0?

I have been looking for a clear answer to my question, with unsuccessful results so far... I am using R to compute a linear model between two variables. In a perfect world, I should obtain a ...
user avatar
1 vote
0 answers
14 views

How to determine key variables that influence sales trend using regression model (or a different model) [closed]

I have several clients that creates a sales trend. I'm trying to estimate which are the key clients that influence the most in this trend. I'm trying to do this with a simple linear regression model ...
user avatar
  • 11
0 votes
1 answer
85 views

Collinearity in dataset, but I don't know why

I am trying to perform a logistic regression with the lm() function in R. My model is: lm(xrd ~ VariableA*Post, data = DatasetXRD), this is a difference-in-differences model, the R code is based on: ...
user avatar
0 votes
0 answers
152 views

Linear model selection (AIC/dredge function) with non parametric data (residuals are autocorrelated)

I used the dredge function with MuMIn & lme4 package to do a linear model selection with AIC principle. I have about 10 ...
user avatar
5 votes
1 answer
621 views

Interpretation difference between log link and log transformation

I have a question about the interpretation difference between log link of GLM and log transformation of LM. I know that log transformation is for target variable but log link is for mean .But related ...
user avatar
0 votes
0 answers
60 views

Equivalent of "lm" for irregular time series forecasting in R

I have a two column data frame corresponding to time series of the form (Date, Value). I want to predict future values of Value based on this data. I don't need anything fancy, just a quick and dirty ...
user avatar
2 votes
0 answers
35 views

In R there is a problem of intercept and without intercept ,Pearson's Correlation does not follow! Why? (see the bolded resuls)

Xvec <- rnorm(200) Yvec <- 2.6*Xvec + rnorm(200) lmodxy <- lm(Xvec ~ Yvec) lmodyx <- lm(Yvec ~ Xvec) summary(lmodxy) Output ...
user avatar
1 vote
1 answer
237 views

How to interpret interact_plot for categorical x continuous interactions

I'm wondering how to interpret interact_plot plots for categorical x continuous interactions. Here's a toy example to illustrate: ...
user avatar
  • 327
1 vote
3 answers
937 views

Is it possible to imput values using mice package, reshape and perform GEE in R?

I have a longitudinal database that has more than 50% of the missing data of the MAR type. This amount of missing values was a surprise to me because I did not foresee this in the study design, and ...
user avatar
2 votes
1 answer
49 views

P-value decrease upon increase in levels of categorical predictor

When does a p-value (standard error) of a linear model coefficient decrease with increasing levels of categorical predictor variable? Why this happens? I fail to see how collinearity and/or regressing ...
user avatar
0 votes
1 answer
48 views

R lm() solves a singular system without error

To reproduce set.seed(1) N <- 100 x <- rep(1, N) covar <- matrix(rnorm(N * 10), N) lm(x ~ covar) Because of the intercept, I would expect this to be ...
user avatar
  • 231
0 votes
2 answers
76 views

Interpreting lm summary in R? [duplicate]

Consider a dataframe ("df") with three variables (Happiness, Smoke, Depression), where (1) Happiness (DV) = continuous measure of happiness on 1-10 scale, (2) Smoke (IV1) = categorical ...
user avatar
0 votes
1 answer
100 views

Understanding R lm output with categorical variables

I ran the following lm model: basic.model <- lm(Calmness.Score ~ Hours.of.Sleep*Age*Session*Group, data = df) Where ...
user avatar
1 vote
1 answer
20 views

I am looking at the relationship between Age ($x$) and Total Length ($y$) of fish and try to see if there are differences depending on the pedigree

I want to know if there is difference in slope between the two Origins H and W (pedigree), but I am not sure which of those two ...
user avatar
5 votes
1 answer
268 views

Is a random intercept model exactly the same as a linear model with dummy variable?

I have a large household dataset for 28 different countries. Upto now I have used OLS (R command lm()) with 'country' as a dummy variable, to control for unobserved ...
user avatar
0 votes
1 answer
46 views

The effect of the treatment on a coefficient (coefficient difference between treatment and control)

I have an experiment where my dependent variable is Choice. Choice is either 0 or ...
user avatar
  • 239
0 votes
1 answer
28 views

Check if a variable has significantly different effects in 2 samples

I have a variable (Y) measured on 2 different samples (X, 0=clinical, 1=control). I verified that a third variable (BMI, 3 classes) has an interaction with Y based on point plots by plotting X,Y for ...
user avatar
  • 164
0 votes
0 answers
13 views

Lm vector vector of const [duplicate]

Can I ask please: Using ols in lm. I found "surprise", when x is vector (mean is 0) and y is vector of 1 1 1 ...or vector of 0 0 0...(constant) When "forcing" lm without intercept (...
user avatar
0 votes
1 answer
52 views

How to interpret lm output [duplicate]

I've run the lm code below, with one DV and three IVs, and I'm not sure how to interpret the output. What does (Intercept) refer to, and what is that row telling me? What are the other rows telling ...
user avatar
0 votes
1 answer
60 views

Dataset with low and non-linearly correlated variables: suggestions on modelling strategies

I have a dataset with low and non-linearly correlated variables and I am interested in assessing the relations between the Independent Variable (IV) and Dependent Variable (DV), however I am not able ...
user avatar
  • 117
3 votes
0 answers
208 views

Correcting for robust/clustered standard errors within the lm function or replacing the results

Cross posted on Stackoverflow with a bounty of 200. EDIT: I think I have to clarify this question a little bit more. So what I am looking for, is a function in which I can provide both the vcov matrix ...
user avatar
  • 239
5 votes
1 answer
90 views

Why the confidence intervals in a categorical lm() are not calculated at the group level?

This is probably very easy but I could not find a straightforward answer. reproducible example ...
user avatar
  • 266
0 votes
1 answer
558 views

When should I report multiple r-squared versus adjusted r-squared in a linear regression?

I am trying to report the r-squared value for the results of a linear regression in R using the lm package. I noticed that the ...
user avatar
1 vote
1 answer
55 views

Interpreting results of a regression with categorical variable

I am running regression on a dataset with 3 variables: n (an integer), Type (a categorical with levels A, B or C) and value (a numeric). The result of ...
user avatar
  • 268
0 votes
1 answer
45 views

Linear regression without Y variable

I want to perform a linear regression model on a dataset with some bestseller books, the dataset contains 550 the bestseller books - I want to create a lm() model where I predict the variables that ...
user avatar
  • 1
2 votes
1 answer
2k views

How can I test a variable as confounding in linear regression in R?

I'm currently doing the statistical analysis I'm going to use in my article. It's about sleep and some functioning/cognitive measures on mood disorder patients. The problem I have is: I correlated a ...
user avatar

1
2 3 4 5
8