Answers.Body: <p>Now that we've straightened out the data, it seems like the simplest solution is to just linearly interpolate the copy number from your standard curve.</p>
  <p>When I read your standard curve (<code>std</code>) and your sample data (<code>ct</code>) into R, I see that the log10(Ct) fits the copy number fairly well, whereas the linear is a bit harder:</p>
  <p><a href="https://i.sstatic.net/2dhUM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/2dhUM.png" alt="enter image description here" /></a></p>
  <p>So we can fit a model to predict copy number based on Ct on the STD data:</p>
  <pre><code>&gt; fit = lm(std<span class="math-container">$Log10.STD_copies. ~ std$</span>STD_Ct)
  &gt; fit
  
  Call:
  lm(formula = std<span class="math-container">$Log10.STD_copies. ~ std$</span>STD_Ct)
  
  Coefficients:
  (Intercept)   std$STD_Ct  
      10.6847      -0.2357  
  
  # we plug those numbers into the linear equation,
  # taking the mean of the two replicates for a best estimate.
  
  &gt; rowMeans(ct[,2:3]) * -.2357 + 10.6847
  [1] 5.130429 5.210567 5.210567 4.595390 5.469837 6.582341
  [7] 6.636553 6.391424
  
  </code></pre>
  <p>So those are log10(copy number) estimates, of a sort. You can get much more elaborate, of course.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-29T01:27:34.643Z
Answers.Text: I accepted your answer and upvoted for the efforts, however; I'm not getting the correct results, both intercept (45.29) and slope (-4.2435) are not accurate, I suppose the correct formula (to calculate RNA copies) would be `Copy number = 10^((Ct - Intercept)/(Slope)) `
Answers.UserDisplayName: user432797
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-29T03:42:13.873Z
Answers.Text: @user432797 I think that those parameters would come if you fit the model `lm(std$STD_Ct ~std$Log10.STD_copies.)`, which is then intercept 45.26 and slope -4.23. I believe that you simply want to switch your independent and dependent variables to do your prediction.
Answers.UserDisplayName: Maximilian Press
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-29T04:47:35.533Z
Answers.Text: I checked another software and it shows intercept (45.29) and slope (-4.2435) @MaximilianPress so I will proceed with these numbers.
Answers.UserDisplayName: user432797
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-29T05:03:18.967Z
Answers.Text: @user432797 I honestly wouldn't recommend that- I would recommend instead fitting the model as `lm(std$Log10.STD_copies. ~ std$STD_Ct )`, because you are trying to predict copy number from Ct. If you use those parameters that you mention, those are predicting Ct from copy number, which is the opposite of what you want. Obviously, you are free to do as you like, but that does not seem appropriate to me.
Answers.UserDisplayName: Maximilian Press
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-29T05:09:27.540Z
Answers.Text: When I apply my data to this model https://www.researchgate.net/profile/Jack_Gallup/post/How_to_calculate_the_copy_no_in_qPCR_of_the_samples_from_their_respective_Ct/attachment/59d625aa79197b8077983fcd/AS%3A318703059570689%401452996138275/download/Copy+number+question+RG+1-16-16+JMG.xls , I get the same results from basic calculation, if you have a reference that I can refer to, it would be great @MaximilianPress
Answers.UserDisplayName: user432797
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-29T05:31:17.737Z
Answers.Text: I take it back @MaximilianPress I just checked https://www.xxpresspcr.com/glossary/y-intercept/ and y refers to Ct while x refers to log of copies.
Answers.UserDisplayName: user432797
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-29T06:08:53.540Z
Answers.Text: @@MaximilianPress for some reason the number copies with  10.6847      -0.2357 is very high, it doesn't reflect the real expectation, is that ok?
Answers.UserDisplayName: user432797
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-29T15:40:35.083Z
Answers.Text: @user432797 it sounds like there might still be some numerical error. Are the values that I've given in my answer implausible? I can't see your results.
Answers.UserDisplayName: Maximilian Press
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-29T18:31:16.780Z
Answers.Text: I updated the question @MaximilianPress, you see with values that you suggested, I get copies number with negative values and pretty exaggerated (table 2). But when I flip x and y, I get the right and approximate figure (table 1).
Answers.UserDisplayName: user432797
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-29T23:07:50.283Z
Answers.Text: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/116787/discussion-between-maximilian-press-and-user432797).
Answers.UserDisplayName: Maximilian Press
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-28T22:17:44.523Z
Answers.LastActivityDate: 2020-11-28T22:17:44.523Z
Answers.UserDisplayName: Maximilian Press
Body: <p>I have these Ct data from qPCR for a series of samples A-H, I want to quantify the RNA copies of my samples using R:</p>
  <pre><code>Sample_ID   Replicate1_Ct Replicate2_Ct
  A           22.92         24.21           
  B           24.29         22.16           
  C           24.29         22.16           
  D           27.91         23.76           
  E           21.44         22.81           
  F           16.50         18.31           
  G           17.79         16.56                 
  H           17.34         19.09 
  </code></pre>
  <p>In addition, I have measured a standard (STD) curve of copy number of the RNA in question, that I want to use as a reference:</p>
  <pre><code>STD_Ct      STD_copies      Log10(STD_copies)
  33          4.00E+03        3
  28          4.00E+04        4
  24          4.00E+05        5
  20          4.00E+06        6
  15          4.00E+07        7
  12          4.00E+08        8
  
  </code></pre>
  <p>It seems</p>
  <p>This the original data form:
  <a href="https://i.sstatic.net/amPJv.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/amPJv.png" alt="enter image description here" /></a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-28T20:44:18.597Z
Comments.Text: This is pretty unclear- at a minimum we need some explanation of the data table. e.g. why do rows G and H not have standards when all other rows do? Is each row a different  standard sample? Do you have a loading control reaction for each sample?
Comments.UserDisplayName: Maximilian Press
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-28T20:54:56.563Z
Comments.Text: The first two columns are the the mean of two replicates, I wanted to make it simple, the standard is only 6 rows, the standard has nothing to do with the samples, it was there just to build to the standard curve to use it for the absolute method @MaximilianPress
Comments.UserDisplayName: user432797
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-28T21:13:54.487Z
Comments.Text: I will edit the question to makes this clearer.
Comments.UserDisplayName: Maximilian Press
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-28T21:30:42.860Z
Comments.Text: I updated the question with the table from excel @MaximilianPress , it should reflect a better idea.
Comments.UserDisplayName: user432797
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-29T23:11:47.717Z
Comments.Text: Discussion of latest update moved to a chat. I think there is a numerical error in the way the predictions are being generated, but you seem ok with the results so I'm calling this done.
Comments.UserDisplayName: Maximilian Press
Tags: <r><qpcr>
Title: How to calculate RNA copies in qPCR using R?
ThreadText: # How to calculate RNA copies in qPCR using R?
  
  (Asked by: username_0 on 2020-11-28)
  
  I have these Ct data from qPCR for a series of samples A-H, I want to quantify the RNA copies of my samples using R:
  
  ```
  Sample_ID   Replicate1_Ct Replicate2_Ct
  A           22.92         24.21           
  B           24.29         22.16           
  C           24.29         22.16           
  D           27.91         23.76           
  E           21.44         22.81           
  F           16.50         18.31           
  G           17.79         16.56                 
  H           17.34         19.09 
  
  ```
  
  In addition, I have measured a standard (STD) curve of copy number of the RNA in question, that I want to use as a reference:
  
  ```
  STD_Ct      STD_copies      Log10(STD_copies)
  33          4.00E+03        3
  28          4.00E+04        4
  24          4.00E+05        5
  20          4.00E+06        6
  15          4.00E+07        7
  12          4.00E+08        8
  
  ```
  
  It seems
  
  This the original data form:
  [![enter image description here](https://i.sstatic.net/amPJv.png)](https://i.sstatic.net/amPJv.png)
  
  **Tags:** r, qpcr
  
  > **Comments:**
  > **username_1**: This is pretty unclear- at a minimum we need some explanation of the data table. e.g. why do rows G and H not have standards when all other rows do? Is each row a different  standard sample? Do you have a loading control reaction for each sample?  
  > **username_0**: The first two columns are the the mean of two replicates, I wanted to make it simple, the standard is only 6 rows, the standard has nothing to do with the samples, it was there just to build to the standard curve to use it for the absolute method @username_1  
  > **username_1**: I will edit the question to makes this clearer.  
  > **username_0**: I updated the question with the table from excel @username_1 , it should reflect a better idea.  
  > **username_1**: Discussion of latest update moved to a chat. I think there is a numerical error in the way the predictions are being generated, but you seem ok with the results so I'm calling this done.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-11-28. Score: 1 | Accepted answer
  
  Now that we've straightened out the data, it seems like the simplest solution is to just linearly interpolate the copy number from your standard curve.
  
  When I read your standard curve (`std`) and your sample data (`ct`) into R, I see that the log10(Ct) fits the copy number fairly well, whereas the linear is a bit harder:
  
  [![enter image description here](https://i.sstatic.net/2dhUM.png)](https://i.sstatic.net/2dhUM.png)
  
  So we can fit a model to predict copy number based on Ct on the STD data:
  
  ```
  > fit = lm(std$Log10.STD_copies. ~ std$STD_Ct)
  > fit
  
  Call:
  lm(formula = std$Log10.STD_copies. ~ std$STD_Ct)
  
  Coefficients:
  (Intercept)   std$STD_Ct  
      10.6847      -0.2357  
  
  # we plug those numbers into the linear equation,
  # taking the mean of the two replicates for a best estimate.
  
  > rowMeans(ct[,2:3]) * -.2357 + 10.6847
  [1] 5.130429 5.210567 5.210567 4.595390 5.469837 6.582341
  [7] 6.636553 6.391424
  
  ```
  
  So those are log10(copy number) estimates, of a sort. You can get much more elaborate, of course.
  
  > **Comments:**
  > **username_0**: I accepted your answer and upvoted for the efforts, however; I'm not getting the correct results, both intercept (45.29) and slope (-4.2435) are not accurate, I suppose the correct formula (to calculate RNA copies) would be `Copy number = 10^((Ct - Intercept)/(Slope)) `  
  > **username_1**: @username_0 I think that those parameters would come if you fit the model `lm(std$STD_Ct ~std$Log10.STD_copies.)`, which is then intercept 45.26 and slope -4.23. I believe that you simply want to switch your independent and dependent variables to do your prediction.  
  > **username_0**: I checked another software and it shows intercept (45.29) and slope (-4.2435) @username_1 so I will proceed with these numbers.  
  > **username_1**: @username_0 I honestly wouldn't recommend that- I would recommend instead fitting the model as `lm(std$Log10.STD_copies. ~ std$STD_Ct )`, because you are trying to predict copy number from Ct. If you use those parameters that you mention, those are predicting Ct from copy number, which is the opposite of what you want. Obviously, you are free to do as you like, but that does not seem appropriate to me.  
  > **username_0**: When I apply my data to this model https://www.researchgate.net/profile/Jack_Gallup/post/How_to_calculate_the_copy_no_in_qPCR_of_the_samples_from_their_respective_Ct/attachment/59d625aa79197b8077983fcd/AS%3A318703059570689%401452996138275/download/Copy+number+question+RG+1-16-16+JMG.xls , I get the same results from basic calculation, if you have a reference that I can refer to, it would be great @username_1  
  > **username_0**: I take it back @username_1 I just checked https://www.xxpresspcr.com/glossary/y-intercept/ and y refers to Ct while x refers to log of copies.  
  > **username_0**: @@username_1 for some reason the number copies with  10.6847      -0.2357 is very high, it doesn't reflect the real expectation, is that ok?  
  > **username_1**: @username_0 it sounds like there might still be some numerical error. Are the values that I've given in my answer implausible? I can't see your results.  
  > **username_0**: I updated the question @username_1, you see with values that you suggested, I get copies number with negative values and pretty exaggerated (table 2). But when I flip x and y, I get the right and approximate figure (table 1).  
  > **username_1**: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/116787/discussion-between-username_1-and-username_0).  
  
  ---
  
  