how to use glm function to predict the factor in value
3
0
Entering edit mode
3.1 years ago
BenHu • 0

I have four samples（A,B,C,D） and 2 class gene lists(E,F). for example, one gene, belonged to E, in A showed positivie(referred to as 1), but it in B,C and D showed negative(referred to as 0). how to use glm to predict the role of the samples and gene list on values(1 or 0)? like this one:

pc  list    id  gene
1   E   A   AIFM1
0   E   B   AIFM1
1   E   C   AIFM1
NA  E   D   AIFM1
0   F   A   ARAF
0   F   B   ARAF
1   F   C   ARAF
1   F   D   ARAF


next-gen • 708 views
0
Entering edit mode
3.1 years ago

I'd advice to make the question readable =( I have some experience with glm but I can not parse the question.

0
Entering edit mode

so sorry.

I have 4 samples (A,B,C and D) and 2 gene lists (E and F). for example, expression value of one gene in E cluster showed 1.1,2.0,0.5 and 0 in A, B, C and D samples, respectively. if the expression value was less than 1.0, then I assigned 0, otherwise, 1.

1. sample cluster value
2. A E 1.1 1
3. B E 2.0 1
4. C E 0.5 0
5. D E 0 0
6. A F 1.2 1
7. B F 2.0 1
8. C F 0.2 0
9. D F 3.0 1

my question: how to use glm or other methods to predict the role of the samples and gene list on values(1 or 0)?

0
Entering edit mode

Do you mean a model like

Value ~ Cluster + Sample?


If that's the case, you can just run glm in R with

glm(Value~Cluster+Sample, data=data, family=binomial)


Where data contains the data.frame. R should automatically dummy coded the categorical variables.

0
Entering edit mode

thanks a lot. I did that. but the result showed that the sample was not significant. I am not sure whether glm is suitable for 2 variables containing 2 and 4 categories.

0
Entering edit mode

I hope your dataset is larger than 8 rows. I would not do dichotomizations. Do not switch from the raw values to this zero one coding. You loose power, and not only this is bad.

0
Entering edit mode

Indeed, you need a larger dataset.

0
Entering edit mode
3.1 years ago

If you want to learn the basics about building models and making model predictions, then take a look at our slides, 'RTrainingLect3.pptx', located here: https://github.com/kevinblighe/Rtutorials

0
Entering edit mode

thanks a lot. I will take a look.