0
votes

First time writing in here, so I apologize if something is missing.

I am comparing two DNA quantification methods and I am trying to see which method gives me results closer to the real ones (the DNA that I added to the samples).

For each method I have 5 replicates. I put 1000 cells in each sample (expected value) and got the following quantification values (observed values):

  • Method P - 500, 400, 400, 500, 500
  • Method Q - 1000, 900, 1400, 700, 1000

When I try to use the chisq() function, I appear not to be able to tell the function which are the expected values, it calculates the expected values and that is not what I want.

> P<-c(500, 400, 400, 500, 500)

> Q<-c(1000, 900, 1400, 700, 1000)

> chisqQ <- chisq.test(Q)
Chi-squared test for given probabilities

data:  Q
X-squared = 260, df = 4, p-value < 2.2e-16

> chisqP <- chisq.test(P)

    Chi-squared test for given probabilities

data:  P
X-squared = 26.087, df = 4, p-value = 3.039e-05

The problem with this is that I do not establish my expected values, and while for the Q it automatically calculates 1000, for the P it doesn't

> round(chisqQ$expected,2)
[1] 1000 1000 1000 1000 1000

> round(chisqP$expected,2)
[1] 460 460 460 460 460

There is the p argument in the chisq function, but it has to be a probability, which is not my case.

I have calculated the chi square values by hand on excel and compare them, but once, in the future, I will have several techniques and several cell amounts I would like to know if it is possible to do in R.

Thanks in advance,

Cheers,

Joana

1
Give us some reproducible data or example, and show the codes you wrote so far... That will help you to get answers...Thai

1 Answers

0
votes

So if I understand this correctly, you already have the expected values and want to use chi square to see how good of a fit you have.

If so the following solution will work.

obs <- c(500,400,400,500,500)
exp <- c(XX, XX, XX, XX, XX)
chisq.test(x = observed, p = expected)