Using and Producing a Control Chart in R for Statistical Process Control – An Application in Analytical Chemistry

Introduction

Many processes in chemistry, especially in synthesis, require attaining a certain target value for a property of interest.  For example, when synthesizing drug capsules that contain a medicine, a chemist has to ensure that the concentration of the medicine meets a target value.  If the concentration is too high or too low, then the patient ingesting the drug capsules could suffer catastrophic health problems.  Thus, monitoring this attainment is a very important part of analytical chemistry.

Of course, natural variation in any chemical process will result in some variation in the output, so the target value will rarely be attained exactly.  There is usually an acceptable range of values, but any deviation of the output beyond this acceptable range must be discovered and treated with alarm, as the underlying process for generating that output may be inherently faulty.  The process should be stopped, examined, and repaired before any more output can be generated.  From a statistical perspective, there needs to be some mechanism to monitor for outliers as the process unfolds.

A control chart is a useful tool for monitoring chemical processes to detect outliers.  In this tutorial, I will

  • explain the underlying concepts of a simple but common type of control charts
  • demonstrate how to produce control charts with an example data set in R

control chart for vitamin c production

Read the rest of this blog post to learn how to build the above control chart in R!

Read more of this post

Analytical Chemistry Lesson of the Day – Specificity in Method Validation and Quality Assurance

In pharmaceutical chemistry, one of the requirements for method validation is specificity, the ability of an analytical method to distinguish the analyte from other chemicals in the sample.  The specificity of the method may be assessed by deliberately adding impurities into a sample containing the analyte and testing how well the method can identify the analyte.

Statistics is an important tool in analytical chemistry, and, ideally, there is no overlap in the vocabulary that is used between the 2 fields.  Unfortunately, the above definition of specificity is different from that in statistics.  In a previous Machine Learning Lesson and Applied Statistics Lesson of the Day, I introduced the concepts of sensitivity and specificity in binary classification.  In the context of assessing the predictive accuracy of a binary classifier, its specificity is the proportion of truly negative cases among the classified negative cases.

Analytical Chemistry Lesson of the Day – Method Validation in Quality Assurance

When developing any method in analytical chemistry, it must meet several criteria to ensure that it accomplishes its intended objective at or above an acceptable standard.  This process is called method validation, and it has the following criteria* in the pharmaceutical industry

  • specificity
  • linearity
  • accuracy
  • precision
  • range
  • limit of detection
  • limit of quantitation
  • robustness**

As I will note in future Chemistry Lessons of the Day, these words are used differently between statistics and chemistry.

*These criteria are taken from Page 723 of the 6th edition of “Quantitative Chemical Analysis” by Daniel C. Harris (2003).

**The Food and Drug Administration does not list robustness as a typical characteristic of method validation.  (See Section B on Page 7 of its “Guidance for Industry Analytical Procedures and Methods Validation for Drugs and Biologics“.)  However, it does mention robustness several times as an important characteristic that “should be evaluated” during the “early stages of method development”.  

Organic and Inorganic Chemistry Lesson of the Day – Optical Rotation is a Bulk Property

It is important to note that optical rotation is usually discussed as a bulk property, because it’s usually measured as a bulk property by a polarimeter.  Any individual enantiomeric molecule can almost certainly rotate linearly polarized light.  However, in a bulk sample of a chiral substance, there is usually another molecule that can rotate light in the opposite direction.  This is due to the uniform distribution of the stereochemistry of a random sample of the molecules of one compound.  (In other words, the substance consists of different stereoisomers of one compound, and the proportions of the different stereoisomers are roughly equal.)  Because one molecule’s rotation of the light can be cancelled by another molecule’s optical rotation in the opposite direction, such a random sample of the compound would have no net optical rotation.  This type of cancellation will definitely occur in a racemic mixture.  However, if a substance is enantiomerically pure, then all of the molecules in that substance will rotate linearly polarized light in the same direction – this substance is optically active.

Determining chemical concentration with standard addition: An application of linear regression in JMP – A Guest Blog Post for the JMP Blog

I am very excited to announce that I have been invited by JMP to be a guest blogger for its official blog!  My thanks to Arati Mejdal, Global Social Media Manager for the JMP Division of SAS, for welcoming me into the JMP blogging community with so much support and encouragement, and I am pleased to publish my first post on the JMP Blog!  Mark Bailey and Byron Wingerd from JMP provided some valuable feedback to this blog post, and I am fortunate to get the chance to work with and learn from them!

Following the tradition of The Chemical Statistician, this post combines my passions for statistics and chemistry by illustrating how simple linear regression can be used for the method of standard addition in analytical chemistry.  In particular, I highlight the useful capability of the “Inverse Prediction” function under “Fit Model” platform in JMP to estimate the predictor given an observed response value (i.e. estimate the value of x_i given y_i).  Check it out!

JMP blog post - standard addition

Discovering Argon with the 2-Sample t-Test

I learned about Lord Rayleigh’s discovery of argon in my 2nd-year analytical chemistry class while reading “Quantitative Chemical Analysis” by Daniel Harris.  (William Ramsay was also responsible for this discovery.)  This is one of my favourite stories in chemistry; it illustrates how diligence in measurement can lead to an elegant and surprising discovery.  I find no evidence that Rayleigh and Ramsay used statistics to confirm their findings; their paper was published 13 years before Gosset published about the t-test.  Thus, I will use a 2-sample t-test in R to confirm their result.

Lord Rayleigh                                    William Ramsay

Photos of Lord Rayleigh and William Ramsay

Source: Wikimedia Commons

Read more of this post

Follow

Get every new post delivered to your Inbox.

Join 517 other followers