View source: R/stdCurve_fitcompare.R

stdCurve_fitcompare | R Documentation |

To use this function, use `stdCurve`

to fit the same data.frame
two different ways. For example, for one fit, include all data points and for
the other, omit troublesome data points to see their effect on the curve.
Other examples: Try comparing different weighting schemes or comparing 1st-
vs. 2nd-order polynomials. Input to this function is the output from
`stdCurve`

from each of the two different ways.

```
stdCurve_fitcompare(stdCurve1, stdCurve2, fitNames = NA)
```

`stdCurve1` |
The list output from |

`stdCurve2` |
The list output from a variation on |

`fitNames` |
A preferably succinct character vector with two items
describing what the differences are between |

Output is a list of the following named objects:

- CurvePlot
A plot of the data and the fitted lines. The two fits will be in different colors.

- Data
The input data, including the nominal concentration or mass, columns of the calculated concentration for each of the two fit methods, and columns of the calculated concentration or mass as a percent of nominal concentration or mass for each of the two fits.

```
data(ExStdCurve)
# Comparing no weights vs. weighting by 1/x^2
stdCurve1 <- stdCurve(ExStdCurve,
normPeak = MET.peakarearatio,
nominal = MET.nominalmass,
poly = "2nd")
stdCurve2 <- stdCurve(ExStdCurve,
normPeak = MET.peakarearatio,
nominal = MET.nominalmass,
poly = "2nd", weights = "1/x^2")
stdCurve_fitcompare(stdCurve1, stdCurve2)
stdCurve_fitcompare(stdCurve1, stdCurve2, fitNames = c("no weighting", "1/x2 weighting"))
# Comparing all points vs. omitting one point.
stdCurve1 <- stdCurve(ExStdCurve,
normPeak = MET.peakarearatio,
nominal = MET.nominalmass,
poly = "2nd", IDcol = SampleID)
stdCurve2 <- stdCurve(ExStdCurve %>% dplyr::filter(SampleID != "standard 200"),
normPeak = MET.peakarearatio,
nominal = MET.nominalmass,
poly = "2nd", IDcol = SampleID)
stdCurve_fitcompare(stdCurve1, stdCurve2)
stdCurve_fitcompare(stdCurve1, stdCurve2,
fitNames = c("all points", "omit standard 200"))
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.