1,928 questions
1
vote
0
answers
44
views
lm() and glm() equivalence for log-transformed response variable [migrated]
I can't seem to wrap my head around this:
What is the glm() equivalent for lm(log(y) ~ x1 + x2, data=data)?
Is it?
a. glm(y ~ x1 + x2, data=data, family=gausssian(link="log"))
b. glm(log(y) ...
1
vote
1
answer
52
views
Why does enabling long mode throw the bootloader into boot loop and mess up GDT base when PM mode works fine without LM code?
Problem
I have a working PM code, but as soon as I add LM setup, the GDT base gets assigned a garbage address, cr registers don't load properly and I get into a boot loop.
I tried hard-coding the ...
0
votes
0
answers
49
views
Event Study Design using OLS yields estimates despite no variance in outcome variable
I am running an event study design and get some unexpected behavior using OLS. One of my outcome variables is by definition zero before the treatment, i.e., whenever event time is weakly smaller than ...
1
vote
1
answer
55
views
Error conducting regression (stepwise) AIC is -infinity for this model, so 'step' cannot proceed
This is my first consult, happy to share the community :) (You would notice I'm not a native english speaker and also I'm not very good using R, actually these are my firsts steps).
I'm trying to ...
0
votes
1
answer
51
views
Stepwise Set of Independent Variable Enter Together
Is there a way in the stepwise procedure to control that a set of variables get added or removed as a group? Particularly, if I form a squared value of variable, that the linear and squared term would ...
0
votes
2
answers
98
views
Are there any faster rolling window regression packages in R? [closed]
This question comes up regularly, especially in the context of finance where one wants to calculate rolling exposures to factors, but there seems to be no answer. There are a number of R packages, ...
0
votes
1
answer
58
views
Using map() with GAM model
I have a code that works if I am using LM but not if I am using a GAM. I guess the that for whatever reason LM looks inside object for the variable and GAM just looks at the names of the object but I ...
1
vote
2
answers
123
views
Linear regression in R: Receiving different results based on dummy coding
I am performing a linear regression with one continuous predictor and one categorical (two levels) predictor. I have included the categorical factor as a named factor ("Control" and "BD&...
1
vote
1
answer
105
views
Create lm-class object with cluster bootstrap in it (R), or: cluster bootstrap for sensemakr() [closed]
EDIT: I would like help closing my question. This question was originally posted on Cross Validated, should have stayed there because the answer is more of a statistics question and not a programming ...
1
vote
1
answer
69
views
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 ...
1
vote
1
answer
127
views
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 ...
4
votes
0
answers
303
views
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 ...
0
votes
2
answers
138
views
How can I save results of multiple R models to a csv?
I was able to create a tibble with results of 12 linear models as lists with the code below. These are linear models between average monthly flow (MMF) and watershed area (DRAINAGE_AREA_GROSS) and the ...
0
votes
0
answers
63
views
How should I visualise my interpretation?
I'm doing an analysis on how wind turbine parameters affect wind speed. Dataset from: https://datadryad.org/stash/dataset/doi:10.5061/dryad.vx0k6djxg
mod4= lm(wind_speed~turbine_distance* rotor_size *...
0
votes
1
answer
90
views
Why do I get the same results with different cross-validation specifications in caret for `lm`
I am using the caret package for fitting different models with the same data. I am using cross-validation for all of them; however, when I use different number of folds with the lm method, I get the ...
1
vote
1
answer
283
views
How to extract Correlation of Coefficients table from models like glm?
After running a statistical model in R (e.g., glm, lm, lme4::lmer, etc.), I run the summary() command with corr=TRUE to get the Correlation of Coefficients table. It features a matrix of correlations ...
1
vote
1
answer
48
views
Linear model slope gives NA when reducing original data
I have a df with a response variable that changes with time. When plotting the data, there is a plateau of which I want to get rid of, since I need the steepest slope of the regression:
time=c("...
0
votes
2
answers
104
views
How to add "slope" function (excel) in R
I'm trying to move data wrangling from excel to R.
I have a dataframe (df) with 62 columns and 21 rows. Each of the rows represents a different organisation, and each of the column headings (apart ...
0
votes
2
answers
51
views
Is it possible to read out the coefficients of linear model instead of training with data in R?
I have the following situation:
I have some data and train some linear model on it (potentially with some interaction terms). I save the coefficients of this model, so other programs than R can also ...
1
vote
2
answers
2k
views
How to calculate variance explained by a variable of interest, in a lm model with covariates?
I am working in R on linear regressions with covariates, looking like : lm(x ~ y + a + b + c)
With the summary() function, I can get the p value corresponding to each of the variables of the model. ...
0
votes
0
answers
69
views
How can I compare the results of two lmRob() models?
I am looking for a way to compare the results from two lmRob() functions statistically.
Here is an explanation of what I am trying to do: My professor wants me to compare the results of two ANCOVAs (...
0
votes
0
answers
407
views
geom_smooth (method = "lm", se = False) - I run this and it changes my Y values
I'm having issues when I run geom_smooth. When I run my script without it my y limits are correct, however when I add geom_smooth my y values are incorrect. When I try to set a limit an error pops up ...
0
votes
1
answer
201
views
Can I add a randoma effect to stat_poly_eq() in ggplot?
I am interested in adding a random effect to a ggplot using stat_poly_eq().
library (ggplot2)
library(ggpmisc)
data (mtcars)
mtcars$gear <- factor (mtcars$gear)
mtcars$cyl <- factor (...
1
vote
2
answers
115
views
How to return the last two lines of summary output from a linear model in R?
After finding a regression prediction in lm I want to return only last two lines of the summary. What would be the best function to use?
my_model_lm(y ~ x1 + x2 + x3, data = [data])
summary_result <...
1
vote
1
answer
239
views
object not found in mediation model
I have to plan a simple mediation model - https://cran.r-project.org/package=mediation
library(mediation)
mediation_model = lm(as.numeric(Age) ~ as.numeric(condition), data = GRA)
tab_model(...