Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
2 votes
0 answers
45 views

Dropped variable in regression output in R

I am running a linear regression trying to predict an outcome y that is a numeric, continuous variable based on a variable with three levels (A,B,C) and three more variables that represent the ...
user avatar
5 votes
2 answers
109 views

How to calculate the reference level interaction in regression in R?

I am very confused on calculating the reference level interaction in regression in R. Here is the sample code: ...
doraemon's user avatar
  • 364
2 votes
2 answers
94 views

Recreate `lm` Categorical Regression

Consider the code, which contains regression using lm of two categorical and one continuous variables without interaction using data from the correct model: ...
温泽海's user avatar
  • 639
0 votes
1 answer
57 views

Indicator variables/treatment variables as an independent variable?

Can a dummy variable or treatment variable be an independent variable? My independent variable take the value 1 if a flood occurs in a specific country in a specific year and 0 if no flood happens. ...
zeinab hassano's user avatar
0 votes
0 answers
34 views

Why does removing the offset change the F-statistic of an anova model in R?

When a linear model with only a single categorical variables is defined without an offset, the F-statistic reported by summary() and ...
meta7's user avatar
  • 1
3 votes
1 answer
45 views

Logistic regression in R: Handling mixed numerical and categorical variables

I'm attempting to fit a logistic regression model in R and need some guidance on handling both numerical and categorical variables simultaneously, especially when looking for significant explanatory ...
kabin's user avatar
  • 131
0 votes
0 answers
36 views

Opinion about conversion of factor to numeric variable during model development using caret package

caret package automatically converts factor variables to one-hot encoding. We can also convert the factor variable to a numeric variable before training any model. ...
UseR10085's user avatar
  • 107
4 votes
1 answer
278 views

Should I remove the intercept when I have one dummy variable that covers all the categories in a categorical variable?

I have a categorical variable that has $4$ categories, and I have two dummy variables, $x_1$ and $x_2$, that cover this categorical variable. The $x_1$ variable has values of only $1$ without any ...
user400487's user avatar
2 votes
1 answer
454 views

When I change my reference level on my GLMER in R, why do the p-values change and why don't the estimates add up? Emmeans solution in answer

I am new to this. My study has three conditions (between subjects - low coordination, high coordination, high coordination with ostensive cues) and three repetitions of a game (within subjects - Game ...
Melissa D. Perring's user avatar
0 votes
1 answer
34 views

Differences in Regression model for Dummy Coding (factor vs. recode) [closed]

I have the following problem: I generate Dummy Variables with the recode and the factor command. In my regression I got different output for the "lower middle" variable and couldn't explain ...
Marvin11's user avatar
1 vote
0 answers
82 views

Difference between using a categorical variable vs separate dummy variables

I have 2 drug treatment groups, namely Cis and RT. So, a cell is either exposed to none, Cis only, RT only, or a combination of Cis+RT. There is also another cancer modality group. I would like to ...
HNSKD's user avatar
  • 227
0 votes
1 answer
69 views

OLS model specification that includes all dummy variables with a predetermined coefficient

I'm working with a OLS model that includes dummy variables (quarters of year). Here's what I would specify it: $$y = \beta X + \gamma_1Q_1 + \gamma_2Q_2 + \gamma_3Q_3 + \epsilon$$ However, in the ...
NonSleeper's user avatar
3 votes
1 answer
362 views

Categorical variable disappears in Poisson GLM summary?

For the variable SelfEthnicity there is meant to be 4 levels. I have made it so there should not be a reference category, but the R output still only shows 3 Ethnicities. ...
user avatar
3 votes
1 answer
558 views

Does it make sense to convert a single dummy variable into a factor?

I have an R lecture script infront of me, where we are using logistic regression to try to predict the probability that an observation belongs to the target class (e.g. y_i = 1) or not (e.g. y_i = 0). ...
jjunk's user avatar
  • 31
0 votes
1 answer
32 views

Finding model for categorical Data

I'm trying to find out a model that adequately describes effects of gender and length on food choice. For gender; 0=Male and 1=Female, length; 0=Subadult 1=Adult, Choice; F=Fish I=Invertebrates and O=...
Booba's user avatar
  • 3
0 votes
0 answers
23 views

Showing names of levels in glmer R [duplicate]

I have a simple question that would help me a lot in interpreting my results I ran a glmer model in R with the following variables: a binary DV that is dummy coded a categorical IV1 named "...
Alaa's user avatar
  • 23
3 votes
2 answers
1k views

Which groups are reference groups in a regression model with interaction?

What are the reference groups in a regression model where there are interaction categories? Using the iris dataset in R, I've created a category with three levels ...
geoscience123's user avatar
3 votes
5 answers
2k views

Multiple linear regression with lm() in R, why is the intersection dependent on the name of the "first" country

I have a question about the function lm() used for multiple linear regression analysis. Context: We have a dataset (that I cannot share) where $y$ is the proportion ...
user avatar
1 vote
0 answers
2k views

How to interpret SEM mediation analysis results (using Lavaan in R) with binary exposure and outcome variables

I have built SEM model in R using Lavaan. My aim is to report on the indirect effect. The data I am using is confidential, so I will not be able to share it or provide a reproducible example. Since I ...
capmo's user avatar
  • 11
0 votes
1 answer
68 views

Are these effects missing from my glm output because of a possible dummy trap?

I have a few generalized linear mixed model questions. I have an experiment that asked "is there a differential response between asexuals and sexuals by population density?". I am ...
bribina's user avatar
  • 55
2 votes
1 answer
117 views

how to interpret classes dependence that are not the reference class in a linear model

If we run the three following codes: ...
FluidMechanics Potential Flows's user avatar
2 votes
1 answer
178 views

Am I interpreting my lm() summary() results correctly in R?

(this question I originally posted in stack overflow) I want to know if I am interpreting the factor() function in R correctly. Suppose I have a variable with 10 ...
ineedhelp's user avatar
  • 355
1 vote
1 answer
504 views

should I use n-1 dummies variables or all variables for a multinomial logistic regression?

Recently I have been working with gut microbiome data, like abundance and its metabolic content (but for purposes of the question this may be indifferent). I'm inexpert in the field of multinomial ...
JP_SC's user avatar
  • 11
0 votes
0 answers
793 views

Missing outputs or coefficients from multiple linear regression?

I have a multiple linear regression I have completed below: ...
barnsm2's user avatar
  • 155
1 vote
1 answer
3k views

Using dummy variables in a linear regression model in R - no need to manually encode when using factor or character string vector types?

A source of confusion that I often come across relates to when people want to use categorical data, where the number of categories is greater than 2, in a linear regression (simple or multiple) and ...
Seanosapien's user avatar
1 vote
1 answer
180 views

Custom-define contrast - mix between dummy and Helmert coding

I'm trying to use custom-defined contrasts. They are sort of a combination of traditional dummy coding and the last contrast produced by reversed Helmert coding. In short, I want to compare each of ...
jO.'s user avatar
  • 153
1 vote
1 answer
3k views

Is one-hot encoding required for categorical variables in R (logistic regression)?

I created a logistic regression model in R and fit the model using the MumIn package. I have several categorical variables that were coded as factors. For example, season (summer, fall, winter, spring)...
C_Marie's user avatar
  • 39
1 vote
1 answer
2k views

Interaction effects in regression models - should I include reference category?

I have a question about coding interaction effects using dummy coding which I’d be really grateful for your advice on please. Imagine I want to design an experiment to measure the impact of amount of ...
george_psych's user avatar
1 vote
1 answer
4k views

Interpreting GLM output with categorical data

I am having trouble identifying which reference level R is using for my response variable matnew. I know it sometimes chooses alphabetically, which in this case is "Fail", but I'm not sure ...
dolly's user avatar
  • 31
0 votes
1 answer
800 views

Difference-in-Difference with two control groups and one treatment group over the same period of time using RStudio

So I'm trying to run a regression for one of my economics classes with one treatment group and two control groups over a period of time. I'm currently trying to create a dummy (binary) variable to ...
Colton Schlegel's user avatar
0 votes
0 answers
241 views

Framework for applying weights to binary variables in regression

Say I am training a ridge regression model on nothing but binary variables. The context being that each variable represents a player - a value of 1 meaning they were playing the game at the time, ...
Machetes0602's user avatar
2 votes
1 answer
713 views

"Group mean centering" a dummy Variable in R for multilevel analysis: how can i do this?

have somebody an idea of how to group mean center a dummy Level 1 predictor in R? Enders & Tofighi (2007) describe a method to center a dummy variable through substracting the proportion of the ...
JoBen's user avatar
  • 21
1 vote
0 answers
43 views

How can model be significant if no predictors are significant?

Here is my model and output: ...
Elasso's user avatar
  • 99
3 votes
1 answer
3k views

Difference between dummy and factor variable?

I've just learnt about dummy variables. Say this is my data: Location Nest XXX Yes XXX No ZZZ Yes YYY Yes YYY No And I want to do multicolinearity tests/logistic regression in RStudio, so I don'...
Burton Guster's user avatar
1 vote
0 answers
380 views

How to code a contrast matrix for repeated contrasts (comparing adjacent levels) where the intercept corresponds with the grand mean?

In brief: How to code a contrast matrix for repeated contrasts (comparing adjacent levels) where the intercept corresponds with the grand mean? Example-Problem: A factor of 10 levels. Each contrast ...
WhiteSwanBlackSwan's user avatar
0 votes
0 answers
633 views

Why do sum and treatment contrasts give the same coefficients in linear regression?

I have been given a dummy dataset upon which linear regression is performed and treatment and sum contrasts outputs are compared. In this scenario the coefficients are exactly the same and I don't ...
terraregina's user avatar
3 votes
1 answer
909 views

Interpreting the effects of dummy interactions

Warning This question is quite long, and maybe a lot of you will think it is too long. I however thought, and hope, that if this question gets a proper answer, it will actually be a really good post ...
Tom's user avatar
  • 528
3 votes
1 answer
352 views

Helmert coding for mixed models in R

I am using R to analyse data from an experiment with six conditions. Condition has two dimensions: for cognitive load, I have two levels (load and ...
shleen's user avatar
  • 31
0 votes
2 answers
468 views

Regression/classification models and dummy variables [duplicate]

I want to build regression model (linear and logit) but one of my independent variables is categorical variable with levels "Gym", "School", "Hospital", "Others"...
HSmile's user avatar
  • 1
0 votes
1 answer
139 views

Interpreting categorical variable if reference class includes several levels

I have a dataset with several categorical variables. I have been running some regressions and used dummy coding for these categorical variables. The problem is that some specifications lead to perfect ...
Kamyen's user avatar
  • 5
0 votes
1 answer
241 views

Regression in R - dummy variables

Hey I want to build a model in R and one of my idependent variable is categorical (it takes 10 different values). I change the type of this variable from "char" to factor and build a model ...
Math122's user avatar
  • 117
0 votes
2 answers
72 views

R: Interpreting high co-efficient with low p-value for a binary variable

I am looking at baby weight data. Now a baby's gender is either male or female. A linear regression model to predict a baby's weight has a high coefficient (-0.38 for female and +0.38 for male). It ...
user avatar
2 votes
1 answer
68 views

Interpreting logistic regression coefficients of a variable overall and levelwise

Context Let Y be a logical vector and X1 a factor with 3 levels. Since Y is binary, logistic regression is used. ...
outofthegreen's user avatar
0 votes
1 answer
1k views

Time effects with dummy variable - regression

I am doing a multiple regression analysis and I wanted to inspect the time effect by using factor(Year) in R. However, I got the following summary results: Do you ...
S_Star's user avatar
  • 3
1 vote
1 answer
996 views

Impute missing values of dummy variables, using R's {caret} package: predicted values in between {0;1}?

I'm using {caret} to impute missing data resulting from non-response to survey questions. All of these variables are defined as numeric, though most are dummies. ...
Dr. Fabian Habersack's user avatar
0 votes
1 answer
29 views

Recalculate the standard error using a different base?

I want to run a GLM with a factor, say car type, as one of the independent variables. Suppose car type has the following levels: sedan, SUV, and truck. And suppose the base level is currently sedan. ...
platypus17's user avatar
1 vote
0 answers
70 views

Interpreting the covariate p-values in a multivariate generalized linear model?

If a covariate in a GLM is "significant" does that mean it is significantly different from the base case (the group not shown)? Say we have three groups, Control, Exp1, Exp2. We are ...
neurostats6's user avatar
1 vote
1 answer
585 views

Why are variables in GLM being split into multiple output variables

I have input for glm that looks like BMI $grp PRS age gene 24.2 1 3.0 77 0.0 33.8 1 4.0 89 0.0 30.3 1 7.0 58 0.0 I’m inputting this into ...
con's user avatar
  • 133
2 votes
1 answer
841 views

Adding a Dummy Variable to glm in R?

I'm running a glm in R with two categorical variables, one of which is binary, the other of which can take on five values. I would like it so that my model returns an intercept value that reflects the ...
scoopfaze's user avatar
1 vote
1 answer
338 views

How to code non-exclusive variables for logistic regresion

I have a question about logistic regression in R. I want to study the influence of certain comorbidities in patients in predicting deceased status(Y/N). So far, I formatted all my comorbidities(17) ...
Brodor's user avatar
  • 11