<p>I do not see a problem here. There are 3 levels corresponding to the three genotypes and genotype <code>A/A</code> is the base (reference) level and the &quot;effects&quot; of the other two genotypes are stated &quot;on top of the base level&quot;.</p>
<p><a href="http://courses.atlas.illinois.edu/spring2016/STAT/STAT200/RProgramming/RegressionFactors.html" rel="nofollow noreferrer">This tutorial</a> on linear regression with factor levels is very useful to understand how to conduct linear regression in general but also goes over the specifics of doing so with R.</p>
<p>Moreover, you created a new discrete (factor) variable out of a continuous variable when you bin BMI status as low or high. You can certainly do so but you can also use it as it is, as a continuous variable. And I guess you forgot to include this variable in your model.</p>

CC BY-SA 4.0
2023-02-22T20:59:26.370Z
Note also that you can set the reference level with [`relevel(subdata$rs11075990, ref = "G/G"`)](https://stackoverflow.com/a/3872213/13095326).
Ian Campbell
CC BY-SA 4.0
2023-02-22T12:44:57.083Z
2023-02-22T12:44:57.083Z
haci
<p>I have next data:</p>
<ul>
<li>age - how old is person, e.g. 17 or 25</li>
<li>bmi - body mass index,  e.g. 18.25 or 29.35</li>
<li>rsXXX - results of genotyping in rs(point), e.g. rs10852521: C/C, C/T and T/T</li>
</ul>
<p>I devide all data in 2 groups <code>bmi_group</code>, create new column bmi_group, remove all rows not in group</p>
<ul>
<li>low - bmi&lt;25.0</li>
<li>high - bmi&gt;=30.0</li>
</ul>
<pre><code>LG = 25.0
HG = 30.0
subdata = subset(all_data, bmi &lt; LG | bmi &gt;= HG)
subdata$bmi_group &lt;- with(subdata, ifelse(bmi &lt; LG, 'low', 'high'))
</code></pre>
<p>I need to find out if a certain allelic variant affects the risk of obesity, taking into account age. I try next:</p>
<pre><code>&gt; model &lt;- glm(imt_group ~ rs11075990+age, data = point.data, family = binomial)
&gt; summary(model)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-2.4209  -0.6968   0.4239   0.6470   2.0662  

Coefficients:
              Estimate Std. Error z value Pr(&gt;|z|)    
(Intercept)    6.07127    0.56333  10.778   &lt;2e-16 ***
rs11075990A/G -0.65093    0.28982  -2.246   0.0247 *  
rs11075990G/G -0.53818    0.35860  -1.501   0.1334    
age           -0.12783    0.01235 -10.351   &lt;2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 568.58  on 430  degrees of freedom
Residual deviance: 403.53  on 427  degrees of freedom
AIC: 411.53

Number of Fisher Scoring iterations: 4
</code></pre>
<p>Problem is genotyping data not binominal - <code>Factor w/ 3 levels &quot;A/A&quot;,&quot;A/G&quot;,&quot;G/G&quot;:</code>. What and how can I do?</p>

<r><molecular-genetics>
GLM for multinomial using r - results of genotyping
# GLM for multinomial using r - results of genotyping

(Asked by: username_0 on 2023-02-22)

I have next data:

age - how old is person, e.g. 17 or 25
bmi - body mass index,  e.g. 18.25 or 29.35
rsXXX - results of genotyping in rs(point), e.g. rs10852521: C/C, C/T and T/T

I devide all data in 2 groups bmi_group, create new column bmi_group, remove all rows not in group

low - bmi<25.0
high - bmi>=30.0

LG = 25.0
HG = 30.0
subdata = subset(all_data, bmi < LG | bmi >= HG)
subdata$bmi_group <- with(subdata, ifelse(bmi < LG, 'low', 'high'))

I need to find out if a certain allelic variant affects the risk of obesity, taking into account age. I try next:
> model <- glm(imt_group ~ rs11075990+age, data = point.data, family = binomial)
> summary(model)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-2.4209  -0.6968   0.4239   0.6470   2.0662  

Coefficients:
              Estimate Std. Error z value Pr(>|z|)    
(Intercept)    6.07127    0.56333  10.778   <2e-16 ***
rs11075990A/G -0.65093    0.28982  -2.246   0.0247 *  
rs11075990G/G -0.53818    0.35860  -1.501   0.1334    
age           -0.12783    0.01235 -10.351   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 568.58  on 430  degrees of freedom
Residual deviance: 403.53  on 427  degrees of freedom
AIC: 411.53

Number of Fisher Scoring iterations: 4

Problem is genotyping data not binominal - Factor w/ 3 levels "A/A","A/G","G/G":. What and how can I do?

**Tags:** r, molecular-genetics

---

## 1 answers

### Answer by username_1 on 2023-02-22. Score: 3

I do not see a problem here. There are 3 levels corresponding to the three genotypes and genotype `A/A` is the base (reference) level and the "effects" of the other two genotypes are stated "on top of the base level".

[This tutorial](http://courses.atlas.illinois.edu/spring2016/STAT/STAT200/RProgramming/RegressionFactors.html) on linear regression with factor levels is very useful to understand how to conduct linear regression in general but also goes over the specifics of doing so with R.

Moreover, you created a new discrete (factor) variable out of a continuous variable when you bin BMI status as low or high. You can certainly do so but you can also use it as it is, as a continuous variable. And I guess you forgot to include this variable in your model.

> **Comments:**
> **username_2**: Note also that you can set the reference level with [`relevel(subdata$rs11075990, ref = "G/G"`)](https://stackoverflow.com/a/3872213/13095326).  

---

