Using L() in dynlm R [closed]
Currently going through the VAR section of the "Econometrics with R" online TB (https://www.econometrics-with-r.org/16.1-vector-autoregressions.html) but I am encountering an error.I run the exact same...
View ArticleAnalyzing three-way interaction with the marginaleffects package [migrated]
I am analyzing the response of varible_A (continuous) to variable_B (continuous), variable_C (continuous), and variable_D (categorical with levels "old" and "new").dat <- structure(list(variable_A =...
View Articleextract coefficients from more than one linear regression model with multiple...
I am trying to generate a data frame of intercepts and coefficients for multiple different linear regression models generated from subsets of a data set. I cannot share my data unfortunately but I can...
View ArticleHow can I achieve the same output in lm() and fixest feols()? (TWFE)
I'm trying to use the fixest package feols() to estimate a TWFE model. I know how to do it using lm(), but I can't get the same output as lm().I'm trying to estimate a TWFE model like this:Here's the...
View ArticleHow to use a subset of multiple columns with some conditions in lm function?
I would like to study the effect of party identification on attitude towards an issue. I'm using a large poll data Democracy Checkup 2020. My regression function goes as follow:mod1 <-...
View ArticleHow to run a complex regression in R (for instance for frequency domain...
I am trying to detrend in a frequency domain.Here is the paper that I am following:Paper. Here is the paper which talks about detrending a frequency domain: Second-Paper.My...
View ArticleCreate lm-class object with cluster bootstrap in it (R), or: cluster...
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...
View ArticleHow to extract the quadratic fit from stat_smooth when using a transformed axis
I am trying to extract the line for my quadratic fit so that I can work out the x coordinate at y = 0.1 but the lm() and the stat_smooth are giving me different fits because of the log transformation...
View Articledifferent R^2 depending on 2SLS and ivreg function (AER)
I want to run an IV regression in R using ivreg from the AER package. The output gives me a negative R^2 which should be impossible as far as I know. When running the same regression manually with 2SLS...
View Articlehow to create circuit MCU, relay, and voltage regulator [closed]
I want to create a circuit using an MCU, relay, and voltage regulator. I already have separate 9V and 12V circuits, and I want to make them switchable by the MCU. I plan to use a relay, specifically an...
View ArticleHow 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...
View ArticleI have got two different confidence intervals. What am I doing wrong? [migrated]
I calculated a 90% confidence interval for the intercept of an OLS regression using R. When I used confint(model, '(Intercept)', level=0.90), I got a different CI from the one I calculated with...
View ArticleError in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :...
Here my dataset is pd and i have split it into training and testing data as pd_train1 and pd_train2 sku national_inv lead_time in_transit_qty forecast_3_month forecast_6_month1 3921548 8 12 0 0 02...
View ArticleLinear 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") and also,...
View Articlehow to fix clang: error: -lm: 'linker' input unused...
I downloaded homebrew, gcc14 and pasted the path on compiler.Then it worked when I pasted the flags: -DCMAKE_C_FLAGS="-Wall -Werror -pedantic-errors -lm -g"But it didn’t build and showed:FAILED:...
View ArticleUsing 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...
View ArticleError when trying to produce a residual panel plot using a polynom in an lm
I think I've encountered a bug when plotting diagnostic plots for models made with lm() including a poly() term using ggResidPanel::resid_panel().df <- data.frame(x=rnorm(100), y=rnorm(100))limo...
View ArticleAre there any faster rolling window regression packages in R?
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, but...
View ArticleHow 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.vx0k6djxgmod4= lm(wind_speed~turbine_distance* rotor_size...
View Article