Logistic Regression in R
Hi Everyone... So, if someone can help a begginer in R and statistics, I have the following type of data in a table
Name Sex Age BN Geno1 rs429358 rs7412 Allele_1 Allele_2 Geno2 Surgery
Name_1 M 69 TT/CC TT CC E3 E3 E3-E3 3
Name_2 M 72 TT/CC TT CC E3 E3 E3-E3 1
The table continues for cases and control subjects for over 800 patients. I'm planning to perform logistic regression in R with glm function. The goal is to do E2E4 x ExEx. I think I know how to do this with the glm function but my question is about the input. How should I format my file to work with glm function?
I've set controls = 0 and affected = 1 to know which group I'm working with. I just don't know how to handle with ExEx genotypes!!
Appreciate any help. Thanks everyone
• 233 views
•
link
0 answers
No answers yet.
Log in to answer this question.
Perhaps you could explain better to what 'E2E4' and 'ExEx' relate? Also, you allude to
control|affected, but I see this nowhere in your sample data. As you admit to being a beginner in both R and statistics, please be very specific about what you are aiming to do, and confirm that you have already searched and tried out various things. Providing more background to this data may also help.Thank you for answering... So, I've provided only a example data from my affected group... The alleles are from APOE gene: E2, E3 and E4 that form genotypes E2E2, E2E3, E2E4 and so on... Specifically, I want to compare E2E4 x E3E3, and others combinations. Tried
glm(affected$genotype ~ control$genotype)but didn't worked! The control = 0 and affected = 1 helps me to segregate both groups in R. Both groups have the same data format as the example above. So, I just want to know how to handle with this kind of data... I've tried some tutorials but the data is way different than the one that I have... For the model I've providedglm(affected$genotype ~ control$genotype), consider $genotype as the column which contains my genotypes (E2E2, E2E3 and so on)Thanks.
Read the documentation of the glm function, you need to specify more parameters.
and you need the proper data structure. You need to put your data in the structure that the function expects.
I suggest you learn first about how to program in R then about generalized linear models before jumping onto some tutorials. Once you've done this here is a worked example.
Alternatively at this stage, it may be better for you to seek help from a local knowledgeable person.