How do i perform chi square test in r?
1
0
Entering edit mode
@babumanish837-8404
Last seen 9.0 years ago
India

 

 

I am following http://www.hindawi.com/journals/bmri/2014/589290/ article for chi square test for gene selection. According to this article all the gene expression of each sample will either be greater or lesser than their respective mean i.e all the gene expression of sample1 will be either lesser than their respective mean or greater than their respective mean. But when i am comparing gene expressions of any sample with their mean of gene, i am getting some are lesser and some are greater. I don't understand i am doing something wrong or my data is wrong. I am using gds4515 dataset of bioconductor.

row of eset contain genes and column of eset contain samples.

The following code for first 20 genes of first sample

tempFunc <- function(eset) { #eset is my expression set
exprsEset <- exprs(eset)
meanGene=c()
for(i in 1:20)
{
meanGene[i]=mean(exprsEset[i,])
}

for(i in 1:20)
{
    cat("meanGene = ",meanGene[i])
    cat("exprsEset = ",exprsEset[i,1])
    if(exprsEset[i,1]>meanGene[i])
        print("greater")
    else if(exprsEset[i,1]<meanGene[i])
        print("lesser")
    else
        print("equal")
}

}

And here is the output

  • meanGene = 3.301822 exprsEset = 3.363718[1] "greater"

  • meanGene = 2.61106 exprsEset = 2.755734[1] "greater"

  • meanGene = 2.614429 exprsEset = 2.52532[1] "lesser"

  • meanGene = 3.016704 exprsEset = 2.947369[1] "lesser"

  • meanGene = 1.930851 exprsEset = 1.868928[1] "lesser"

  • meanGene = 2.980301 exprsEset = 3.017314[1] "greater"

  • meanGene = 2.50876 exprsEset = 2.445917[1] "lesser"

  • meanGene = 2.260986 exprsEset = 2.292166[1] "greater"

  • meanGene = 2.561356 exprsEset = 2.517724[1] "lesser"

  • meanGene = 1.924788 exprsEset = 1.825676[1] "lesser"

  • meanGene = 2.843669 exprsEset = 3.019766[1] "greater"

  • meanGene = 3.016528 exprsEset = 3.032245[1] "greater"

  • meanGene = 2.659819 exprsEset = 2.589222[1] "lesser"

  • meanGene = 3.297349 exprsEset = 3.287197[1] "lesser"

  • meanGene = 3.037114 exprsEset = 2.964646[1] "lesser"

  • meanGene = 2.881649 exprsEset = 2.941078[1] "greater"

  • meanGene = 2.403006 exprsEset = 2.41512[1] "greater"

  • meanGene = 2.469731 exprsEset = 2.425784[1] "lesser"

  • meanGene = 3.128546 exprsEset = 3.076901[1] "lesser"

  • meanGene = 2.620181 exprsEset = 2.627992[1] "greater"

But all of them should be either greater or lesser, not combination of both.

microarray chisquare bioconductor bioinformatics • 1.5k views
ADD COMMENT
1
Entering edit mode
Aaron Lun ★ 28k
@alun
Last seen 49 minutes ago
The city by the bay

This isn't really a Bioconductor question - "gds4515" refers to a GEO accession number rather than a Bioconductor package (whether you got it from GEOquery or not is irrelevant to the topic of your post). Also, there's no mention of a Bioconductor package within the paper. You'd be better off contacting the authors of the article, if you want to know how they implemented their tests or how to interpret the results of those tests.

ADD COMMENT
0
Entering edit mode

Thank You @Aaron Lun for your reply. I will try to contact him.

ADD REPLY

Login before adding your answer.

Traffic: 779 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6