This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how to use glm function to predict the factor in value

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

thanks in advance!

next-gen

3 answers

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

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)?

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.

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.

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.

Indeed, you need a larger dataset.

yes, the dataset is large.

yes, the dataset is large

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

thanks a lot. I will take a look.

yes, the dataset is large.

Log in to answer this question.