text:
#jsDisabledContent { display:none; } My Account | Register | Help

# Holoenzyme

Article Id: WHEBN0000081657
Reproduction Date:

 Title: Holoenzyme Author: World Heritage Encyclopedia Language: English Subject: Collection: Publisher: World Heritage Encyclopedia Publication Date:

### Holoenzyme

"Biocatalyst" redirects here. For the use of natural catalysts in organic chemistry, see Biocatalysis.

Enzymes are large biological molecules responsible for the thousands of metabolic processes that sustain life.[1][2] They are highly selective catalysts, greatly accelerating both the rate and specificity of metabolic reactions, from the digestion of food to the synthesis of DNA. Most enzymes are proteins, although some catalytic RNA molecules have been identified. Enzymes adopt a specific three-dimensional structure, and may employ organic (e.g. biotin) and inorganic (e.g. magnesium ion) cofactors to assist in catalysis.

In enzymatic reactions, the molecules at the beginning of the process, called substrates, are converted into different molecules, called products. Almost all chemical reactions in a biological cell need enzymes in order to occur at rates sufficient for life. Since enzymes are selective for their substrates and speed up only a few reactions from among many possibilities, the set of enzymes made in a cell determines which metabolic pathways occur in that cell.

Like all catalysts, enzymes work by lowering the activation energy (Ea) for a reaction, thus dramatically increasing the rate of the reaction. As a result, products are formed faster and reactions reach their equilibrium state more rapidly. Most enzyme reaction rates are millions of times faster than those of comparable un-catalyzed reactions. As with all catalysts, enzymes are not consumed by the reactions they catalyze, nor do they alter the equilibrium of these reactions. However, enzymes do differ from most other catalysts in that they are highly specific for their substrates. Enzymes are known to catalyze about 4,000 biochemical reactions.[3] A few RNA molecules called ribozymes also catalyze reactions, with an important example being some parts of the ribosome.[4][5] Synthetic molecules called artificial enzymes also display enzyme-like catalysis.[6]

Enzyme activity can be affected by other molecules. Inhibitors are molecules that decrease enzyme activity; activators are molecules that increase activity. Many drugs and poisons are enzyme inhibitors. Activity is also affected by temperature, pressure, chemical environment (e.g., pH), and the concentration of substrate. Some enzymes are used commercially, for example, in the synthesis of antibiotics. In addition, some household products use enzymes to speed up biochemical reactions (e.g., enzymes in biological washing powders break down protein or fat stains on clothes; enzymes in meat tenderizers break down proteins into smaller molecules, making the meat easier to chew).

## Etymology and history

As early as the late 17th and early 18th centuries, the digestion of meat by stomach secretions[7] and the conversion of starch to sugars by plant extracts and saliva were known. However, the mechanism by which this occurred had not been identified.[8]

In 1833, French chemist Anselme Payen discovered the first enzyme, diastase. A few decades later, when studying the fermentation of sugar to alcohol by yeast, Louis Pasteur came to the conclusion that this fermentation was catalyzed by a vital force contained within the yeast cells called "ferments", which were thought to function only within living organisms. He wrote that "alcoholic fermentation is an act correlated with the life and organization of the yeast cells, not with the death or putrefaction of the cells."[9]

In 1877, German physiologist Wilhelm Kühne (1837–1900) first used the term enzyme, which comes from Greek ενζυμον, "in leaven", to describe this process.[10] The word enzyme was used later to refer to nonliving substances such as pepsin, and the word ferment was used to refer to chemical activity produced by living organisms.

In 1897, Eduard Buchner submitted his first paper on the ability of yeast extracts that lacked any living yeast cells to ferment sugar. In a series of experiments at the University of Berlin, he found that the sugar was fermented even when there were no living yeast cells in the mixture.[11] He named the enzyme that brought about the fermentation of sucrose "zymase".[12] In 1907, he received the Nobel Prize in Chemistry "for his biochemical research and his discovery of cell-free fermentation". Following Buchner's example, enzymes are usually named according to the reaction they carry out. Typically, to generate the name of an enzyme, the suffix -ase is added to the name of its substrate (e.g., lactase is the enzyme that cleaves lactose) or the type of reaction (e.g., DNA polymerase forms DNA polymers).[13]

Having shown that enzymes could function outside a living cell, the next step was to determine their biochemical nature. Many early workers noted that enzymatic activity was associated with proteins, but several scientists (such as Nobel laureate Richard Willstätter) argued that proteins were merely carriers for the true enzymes and that proteins per se were incapable of catalysis.[14] However, in 1926, James B. Sumner showed that the enzyme urease was a pure protein and crystallized it; Sumner did likewise for the enzyme catalase in 1937. The conclusion that pure proteins can be enzymes was definitively proved by Northrop and Stanley, who worked on the digestive enzymes pepsin (1930), trypsin and chymotrypsin. These three scientists were awarded the 1946 Nobel Prize in Chemistry.[15]

This discovery that enzymes could be crystallized eventually allowed their structures to be solved by x-ray crystallography. This was first done for lysozyme, an enzyme found in tears, saliva and egg whites that digests the coating of some bacteria; the structure was solved by a group led by David Chilton Phillips and published in 1965.[16] This high-resolution structure of lysozyme marked the beginning of the field of structural biology and the effort to understand how enzymes work at an atomic level of detail.

## Structures and mechanisms

Enzymes are in general globular proteins and range from just 62 amino acid residues in size, for the monomer of 4-oxalocrotonate tautomerase,[17] to over 2,500 residues in the animal fatty acid synthase.[18] A small number of RNA-based biological catalysts exist, with the most common being the ribosome; these are referred to as either RNA-enzymes or ribozymes. The activities of enzymes are determined by their three-dimensional structure.[19] However, although structure does determine function, predicting a novel enzyme's activity just from its structure is a very difficult problem that has not yet been solved.[20]

Most enzymes are much larger than the substrates they act on, and only a small portion of the enzyme (around 2–4 amino acids) is directly involved in catalysis.[21] The region that contains these catalytic residues, binds the substrate, and then carries out the reaction is known as the active site. Enzymes can also contain sites that bind cofactors, which are needed for catalysis. Some enzymes also have binding sites for small molecules, which are often direct or indirect products or substrates of the reaction catalyzed. This binding can serve to increase or decrease the enzyme's activity, providing a means for feedback regulation.

Like all proteins, enzymes are long, linear chains of amino acids that fold to produce a three-dimensional product. Each unique amino acid sequence produces a specific structure, which has unique properties. Individual protein chains may sometimes group together to form a protein complex. Most enzymes can be denatured—that is, unfolded and inactivated—by heating or chemical denaturants, which disrupt the three-dimensional structure of the protein. Depending on the enzyme, denaturation may be reversible or irreversible.

Structures of enzymes with substrates or substrate analogs during a reaction may be obtained using Time resolved crystallography methods.

### Specificity

Enzymes are usually very specific as to which reactions they catalyze and the substrates that are involved in these reactions. Complementary shape, charge and hydrophilic/hydrophobic characteristics of enzymes and substrates are responsible for this specificity. Enzymes can also show impressive levels of stereospecificity, regioselectivity and chemoselectivity.[22]

Some of the enzymes showing the highest specificity and accuracy are involved in the copying and expression of the genome. These enzymes have "proof-reading" mechanisms. Here, an enzyme such as DNA polymerase catalyzes a reaction in a first step and then checks that the product is correct in a second step.[23] This two-step process results in average error rates of less than 1 error in 100 million reactions in high-fidelity mammalian polymerases.[24] Similar proofreading mechanisms are also found in RNA polymerase,[25] aminoacyl tRNA synthetases[26] and ribosomes.[27]

Whereas some enzymes have broad-specificity, as they can act on a relatively broad range of different physiologically relevant substrates, many enzymes possess small side activities which arose fortuitously (i.e. neutrally), which may be the starting point for the evolutionary selection of a new function; this phenomenon is known as enzyme promiscuity.[28]

#### "Lock and key" model

Enzymes are very specific, and it was suggested by the Nobel laureate organic chemist Emil Fischer in 1894 that this was because both the enzyme and the substrate possess specific complementary geometric shapes that fit exactly into one another.[29] This is often referred to as "the lock and key" model. However, while this model explains enzyme specificity, it fails to explain the stabilization of the transition state that enzymes achieve.

In 1958, Daniel Koshland suggested a modification to the lock and key model: since enzymes are rather flexible structures, the active site is continuously reshaped by interactions with the substrate as the substrate interacts with the enzyme.[30] As a result, the substrate does not simply bind to a rigid active site; the amino acid side-chains that make up the active site are molded into the precise positions that enable the enzyme to perform its catalytic function. In some cases, such as glycosidases, the substrate molecule also changes shape slightly as it enters the active site.[31] The active site continues to change until the substrate is completely bound, at which point the final shape and charge is determined.[32] Induced fit may enhance the fidelity of molecular recognition in the presence of competition and noise via the conformational proofreading mechanism.[33]

Based on Fischer's lock-and-key model and Koshland’s induced fit theory, the Chou’s distorted key theory for peptide drugs was proposed [34] to develop peptide drugs against HIV/AIDS and SARS. [35] [36] [37]

### Mechanisms

Enzymes can act in several ways, all of which lower ΔG (Gibbs energy):[38]

• Lowering the activation energy by creating an environment in which the transition state is stabilized (e.g. straining the shape of a substrate—by binding the transition-state conformation of the substrate/product molecules, the enzyme distorts the bound substrate(s) into their transition state form, thereby reducing the amount of energy required to complete the transition).
• Lowering the energy of the transition state, but without distorting the substrate, by creating an environment with the opposite charge distribution to that of the transition state.
• Providing an alternative pathway. For example, temporarily reacting with the substrate to form an intermediate ES complex, which would be impossible in the absence of the enzyme.
• Reducing the reaction entropy change by bringing substrates together in the correct orientation to react. Considering ΔH alone overlooks this effect.
• Increases in temperatures speed up reactions. Thus, temperature increases help the enzyme function and develop the end product even faster. However, if heated too much, the enzyme's shape deteriorates and the enzyme becomes denatured. Some enzymes like thermolabile enzymes work best at low temperatures.
• The function of a protein is dependent on its structure so that if the structure is disrupted, so is its function.

It is interesting that this entropic effect involves destabilization of the ground state,[39] and its contribution to catalysis is relatively small.[40]

#### Transition state stabilization

The understanding of the origin of the reduction of ΔG requires one to find out how the enzymes can stabilize its transition state more than the transition state of the uncatalyzed reaction. It seems that the most effective way for reaching large stabilization is the use of electrostatic effects, in particular, when having a relatively fixed polar environment that is oriented toward the charge distribution of the transition state.[41] Such an environment does not exist in the uncatalyzed reaction in water.

#### Dynamics and function

The internal dynamics of enzymes has been suggested to be linked with their mechanism of catalysis.[42][43][44] Internal dynamics are the movement of parts of the enzyme's structure, such as individual amino acid residues, a group of amino acids, or even an entire protein domain. These movements occur at various time-scales ranging from femtoseconds to seconds. Networks of protein residues throughout an enzyme's structure can contribute to catalysis through dynamic motions.[45][46][47][48] This is simply seen in the kinetic scheme of the combined process, enzymatic activity and dynamics; this scheme can have several independent Michaelis-Menten-like reaction pathways that are connected through fluctuation rates.[49][50][51]

Protein motions are vital to many enzymes, but whether small and fast vibrations, or larger and slower conformational movements are more important depends on the type of reaction involved. However, although these movements are important in binding and releasing substrates and products, it is not clear if protein movements help to accelerate the chemical steps in enzymatic reactions.[52] These new insights also have implications in understanding allosteric effects and developing new medicines.

### Allosteric modulation

Main article: Allosteric regulation

Allosteric sites are sites on the enzyme that bind to molecules in the cellular environment. The sites form weak, noncovalent bonds with these molecules, causing a change in the conformation of the enzyme. This change in conformation translates to the active site, which then affects the reaction rate of the enzyme.[53] Allosteric interactions can both inhibit and activate enzymes and are a common way that enzymes are controlled in the body.[54]

## Cofactors and coenzymes

### Cofactors

Some enzymes do not need any additional components to show full activity. However, others require non-protein molecules called cofactors to be bound for activity.[55] Cofactors can be either inorganic (e.g., metal ions and iron-sulfur clusters) or organic compounds (e.g., flavin and heme). Organic cofactors can be either prosthetic groups, which are tightly bound to an enzyme, or coenzymes, which are released from the enzyme's active site during the reaction. Coenzymes include NADH, NADPH and adenosine triphosphate. These molecules transfer chemical groups between enzymes.[56]

An example of an enzyme that contains a cofactor is carbonic anhydrase, and is shown in the ribbon diagram above with a zinc cofactor bound as part of its active site.[57] These tightly bound molecules are usually found in the active site and are involved in catalysis. For example, flavin and heme cofactors are often involved in redox reactions.

Enzymes that require a cofactor but do not have one bound are called apoenzymes or apoproteins. An apoenzyme together with its cofactor(s) is called a holoenzyme (this is the active form). Most cofactors are not covalently attached to an enzyme, but are very tightly bound. However, organic prosthetic groups can be covalently bound (e.g., biotin in the enzyme pyruvate carboxylase). The term "holoenzyme" can also be applied to enzymes that contain multiple protein subunits, such as the DNA polymerases; here the holoenzyme is the complete complex containing all the subunits needed for activity.

### Coenzymes

Coenzymes are small organic molecules that can be loosely or tightly bound to an enzyme. Tightly bound coenzymes can be called prosthetic groups. Coenzymes transport chemical groups from one enzyme to another.[58] Some of these chemicals such as riboflavin, thiamine and folic acid are vitamins (compounds that cannot be synthesized by the body and must be acquired from the diet). The chemical groups carried include the hydride ion (H-) carried by NAD or NADP+, the phosphate group carried by adenosine triphosphate, the acetyl group carried by coenzyme A, formyl, methenyl or methyl groups carried by folic acid and the methyl group carried by S-adenosylmethionine.

Since coenzymes are chemically changed as a consequence of enzyme action, it is useful to consider coenzymes to be a special class of substrates, or second substrates, which are common to many different enzymes. For example, about 700 enzymes are known to use the coenzyme NADH.[59]

Coenzymes are usually continuously regenerated and their concentrations maintained at a steady level inside the cell: for example, NADPH is regenerated through the pentose phosphate pathway and S-adenosylmethionine by methionine adenosyltransferase. This continuous regeneration means that even small amounts of coenzymes are used very intensively. For example, the human body turns over its own weight in ATP each day.[60]

## Thermodynamics

As all catalysts, enzymes do not alter the position of the chemical equilibrium of the reaction. Usually, in the presence of an enzyme, the reaction runs in the same direction as it would without the enzyme, just more quickly. However, in the absence of the enzyme, other possible uncatalyzed, "spontaneous" reactions might lead to different products, because in those conditions this different product is formed faster.

Furthermore, enzymes can couple two or more reactions, so that a thermodynamically favorable reaction can be used to "drive" a thermodynamically unfavorable one. For example, the hydrolysis of ATP is often used to drive other chemical reactions.[61]

Enzymes catalyze the forward and backward reactions equally. They do not alter the equilibrium itself, but only the speed at which it is reached. For example, carbonic anhydrase catalyzes its reaction in either direction depending on the concentration of its reactants.

$\mathrm\left\{CO_2 + H_2O \xrightarrow\left\{Carbonic\ anhydrase\right\}$

H_2CO_3} (in tissues; high CO2 concentration)

$\mathrm\left\{H_2CO_3 \xrightarrow\left\{Carbonic\ anhydrase\right\}$

CO_2 + H_2O} (in lungs; low CO2 concentration)

Nevertheless, if the equilibrium is greatly displaced in one direction, that is, in a very exergonic reaction, the reaction is in effect irreversible. Under these conditions, the enzyme will, in fact, catalyze the reaction only in the thermodynamically allowed direction.

## Kinetics

Main article: Enzyme kinetics

Enzyme kinetics is the investigation of how enzymes bind substrates and turn them into products. The rate data used in kinetic analyses are commonly obtained from enzyme assays, where since the 90s, the dynamics of many enzymes are studied on the level of individual molecules.

In 1902 Victor Henri proposed a quantitative theory of enzyme kinetics,[62] but his experimental data were not useful because the significance of the hydrogen ion concentration was not yet appreciated. After Peter Lauritz Sørensen had defined the logarithmic pH-scale and introduced the concept of buffering in 1909[63] the German chemist Leonor Michaelis and his Canadian postdoc Maud Leonora Menten repeated Henri's experiments and confirmed his equation, which is referred to as Henri-Michaelis-Menten kinetics (termed also Michaelis-Menten kinetics).[64] Their work was further developed by G. E. Briggs and J. B. S. Haldane, who derived kinetic equations that are still widely considered today a starting point in solving enzymatic activity.[65]

The major contribution of Henri was to think of enzyme reactions in two stages. In the first, the substrate binds reversibly to the enzyme, forming the enzyme-substrate complex. This is sometimes called the Michaelis complex. The enzyme then catalyzes the chemical step in the reaction and releases the product. Note that the simple Michaelis Menten mechanism for the enzymatic activity is considered today a basic idea, where many examples show that the enzymatic activity involves structural dynamics. This is incorporated in the enzymatic mechanism while introducing several Michaelis Menten pathways that are connected with fluctuating rates.[49][50][51] Nevertheless, there is a mathematical relation connecting the behavior obtained from the basic Michaelis Menten mechanism (that was indeed proved correct in many experiments) with the generalized Michaelis Menten mechanisms involving dynamics and activity; [66] this means that the measured activity of enzymes on the level of many enzymes may be explained with the simple Michaelis-Menten equation, yet, the actual activity of enzymes is richer and involves structural dynamics.

Enzymes can catalyze up to several million reactions per second. For example, the uncatalyzed decarboxylation of orotidine 5'-monophosphate has a half life of 78 million years. However, when the enzyme orotidine 5'-phosphate decarboxylase is added, the same process takes just 25 milliseconds.[67] Enzyme rates depend on solution conditions and substrate concentration. Conditions that denature the protein abolish enzyme activity, such as high temperatures, extremes of pH or high salt concentrations, while raising substrate concentration tends to increase activity when [S] is low. To find the maximum speed of an enzymatic reaction, the substrate concentration is increased until a constant rate of product formation is seen. This is shown in the saturation curve on the right. Saturation happens because, as substrate concentration increases, more and more of the free enzyme is converted into the substrate-bound ES form. At the maximum reaction rate (Vmax) of the enzyme, all the enzyme active sites are bound to substrate, and the amount of ES complex is the same as the total amount of enzyme. However, Vmax is only one kinetic constant of enzymes. The amount of substrate needed to achieve a given rate of reaction is also important. This is given by the Michaelis-Menten constant (Km), which is the substrate concentration required for an enzyme to reach one-half its maximum reaction rate; generally, each enzyme has a characteristic Km for a given substrate. Another useful constant is kcat, which is the rate of product formation handled by one active site and is generally given in units of inverse seconds.

The efficiency of an enzyme can be expressed in terms of kcat/Km. This is also called the specificity constant and incorporates the rate constants for all steps in the reaction. Because the specificity constant reflects both affinity and catalytic ability, it is useful for comparing different enzymes against each other, or the same enzyme with different substrates. The theoretical maximum for the specificity constant is called the diffusion limit and is about 108 to 109 (M−1 s−1). At this point every collision of the enzyme with its substrate will result in catalysis, and the rate of product formation is not limited by the reaction rate but by the diffusion rate. Enzymes with this property are called catalytically perfect or kinetically perfect. Example of such enzymes are triose-phosphate isomerase, carbonic anhydrase, acetylcholinesterase, catalase, fumarase, β-lactamase, and superoxide dismutase.

Michaelis-Menten kinetics relies on the law of mass action, which is derived from the assumptions of free diffusion and thermodynamically driven random collision. However, many biochemical or cellular processes deviate significantly from these conditions, because of macromolecular crowding, phase-separation of the enzyme/substrate/product, or one or two-dimensional molecular movement.[68] In these situations, a fractal Michaelis-Menten kinetics may be applied.[69][70][71][72]

Some enzymes operate with kinetics, which are faster than diffusion rates, which would seem to be impossible. Several mechanisms have been invoked to explain this phenomenon. Some proteins are believed to accelerate catalysis by drawing their substrate in and pre-orienting them by using dipolar electric fields. Other models invoke a quantum-mechanical tunneling explanation, whereby a proton or an electron can tunnel through activation barriers, although for proton tunneling this model remains somewhat controversial.[73][74] Quantum tunneling for protons has been observed in tryptamine.[75] This suggests that enzyme catalysis may be more accurately characterized as "through the barrier" rather than the traditional model, which requires substrates to go "over" a lowered energy barrier.

## Inhibition

Main article: Enzyme inhibitor

Enzyme reaction rates can be decreased by various types of enzyme inhibitors.

Competitive inhibition

In competitive inhibition, the inhibitor and substrate compete for the enzyme (i.e., they can not bind at the same time).[77] Often competitive inhibitors strongly resemble the real substrate of the enzyme. For example, methotrexate is a competitive inhibitor of the enzyme dihydrofolate reductase, which catalyzes the reduction of dihydrofolate to tetrahydrofolate. The similarity between the structures of folic acid and this drug are shown in the figure to the right bottom. In some cases, the inhibitor can bind to a site other than the binding-site of the usual substrate and exert an allosteric effect to change the shape of the usual binding-site. For example, strychnine acts as an allosteric inhibitor of the glycine receptor in the mammalian spinal cord and brain stem. Glycine is a major post-synaptic inhibitory neurotransmitter with a specific receptor site. Strychnine binds to an alternate site that reduces the affinity of the glycine receptor for glycine, resulting in convulsions due to lessened inhibition by the glycine.[78] In competitive inhibition the maximal rate of the reaction is not changed, but higher substrate concentrations are required to reach a given maximum rate, increasing the apparent Km.

Uncompetitive inhibition

In uncompetitive inhibition, the inhibitor cannot bind to the free enzyme, only to the ES-complex. The EIS-complex thus formed is enzymatically inactive. This type of inhibition is rare, but may occur in multimeric enzymes.

Non-competitive inhibition

Non-competitive inhibitors can bind to the enzyme at the binding site at the same time as the substrate,but not to the active site. Both the EI and EIS complexes are enzymatically inactive. Because the inhibitor can not be driven from the enzyme by higher substrate concentration (in contrast to competitive inhibition), the apparent Vmax changes. But because the substrate can still bind to the enzyme, the Km stays the same.

Mixed inhibition

This type of inhibition resembles the non-competitive, except that the EIS-complex has residual enzymatic activity.This type of inhibitor does not follow Michaelis-Menten equation.

In many organisms, inhibitors may act as part of a feedback mechanism. If an enzyme produces too much of one substance in the organism, that substance may act as an inhibitor for the enzyme at the beginning of the pathway that produces it, causing production of the substance to slow down or stop when there is sufficient amount. This is a form of negative feedback. Enzymes that are subject to this form of regulation are often multimeric and have allosteric binding sites for regulatory substances. Their substrate/velocity plots are not hyperbolar, but sigmoidal (S-shaped).

Irreversible inhibitors react with the enzyme and form a covalent adduct with the protein. The inactivation is irreversible. These compounds include eflornithine a drug used to treat the parasitic disease sleeping sickness.[79] Penicillin and Aspirin also act in this manner. With these drugs, the compound is bound in the active site and the enzyme then converts the inhibitor into an activated form that reacts irreversibly with one or more amino acid residues.

Uses of inhibitors

Since inhibitors modulate the function of enzymes they are often used as drugs. A common example of an inhibitor that is used as a drug is aspirin, which inhibits the COX-1 and COX-2 enzymes that produce the inflammation messenger prostaglandin, thus suppressing pain and inflammation. However, other enzyme inhibitors are poisons. For example, the poison cyanide is an irreversible enzyme inhibitor that combines with the copper and iron in the active site of the enzyme cytochrome c oxidase and blocks cellular respiration.[80]

## Biological function

Enzymes serve a wide variety of functions inside living organisms. They are indispensable for signal transduction and cell regulation, often via kinases and phosphatases.[81] They also generate movement, with myosin hydrolyzing ATP to generate muscle contraction and also moving cargo around the cell as part of the cytoskeleton.[82] Other ATPases in the cell membrane are ion pumps involved in active transport. Enzymes are also involved in more exotic functions, such as luciferase generating light in fireflies.[83] Viruses can also contain enzymes for infecting cells, such as the HIV integrase and reverse transcriptase, or for viral release from cells, like the influenza virus neuraminidase.

An important function of enzymes is in the digestive systems of animals. Enzymes such as amylases and proteases break down large molecules (starch or proteins, respectively) into smaller ones, so they can be absorbed by the intestines. Starch molecules, for example, are too large to be absorbed from the intestine, but enzymes hydrolyze the starch chains into smaller molecules such as maltose and eventually glucose, which can then be absorbed. Different enzymes digest different food substances. In ruminants, which have herbivorous diets, microorganisms in the gut produce another enzyme, cellulase, to break down the cellulose cell walls of plant fiber.[84]

Several enzymes can work together in a specific order, creating metabolic pathways. In a metabolic pathway, one enzyme takes the product of another enzyme as a substrate. After the catalytic reaction, the product is then passed on to another enzyme. Sometimes more than one enzyme can catalyze the same reaction in parallel; this can allow more complex regulation: with, for example, a low constant activity provided by one enzyme but an inducible high activity from a second enzyme.

Enzymes determine what steps occur in these pathways. Without enzymes, metabolism would neither progress through the same steps nor be fast enough to serve the needs of the cell. Indeed, a metabolic pathway such as glycolysis could not exist independently of enzymes. Glucose, for example, can react directly with ATP to become phosphorylated at one or more of its carbons. In the absence of enzymes, this occurs so slowly as to be insignificant. However, if hexokinase is added, these slow reactions continue to take place except that phosphorylation at carbon 6 occurs so rapidly that, if the mixture is tested a short time later, glucose-6-phosphate is found to be the only significant product. As a consequence, the network of metabolic pathways within each cell depends on the set of functional enzymes that are present.

## Control of activity

There are five main ways that enzyme activity is controlled in the cell.

1. Enzyme production (transcription and translation of enzyme genes) can be enhanced or diminished by a cell in response to changes in the cell's environment. This form of gene regulation is called enzyme induction and inhibition. For example, bacteria may become resistant to antibiotics such as penicillin because enzymes called beta-lactamases are induced that hydrolyze the crucial beta-lactam ring within the penicillin molecule. Another example are enzymes in the liver called cytochrome P450 oxidases, which are important in drug metabolism. Induction or inhibition of these enzymes can cause drug interactions.
2. Enzymes can be compartmentalized, with different metabolic pathways occurring in different cellular compartments. For example, fatty acids are synthesized by one set of enzymes in the cytosol, endoplasmic reticulum and the Golgi apparatus and used by a different set of enzymes as a source of energy in the mitochondrion, through β-oxidation.[85]
3. Enzymes can be regulated by inhibitors and activators. For example, the end product(s) of a metabolic pathway are often inhibitors for one of the first enzymes of the pathway (usually the first irreversible step, called committed step), thus regulating the amount of end product made by the pathways. Such a regulatory mechanism is called a negative feedback mechanism, because the amount of the end product produced is regulated by its own concentration. Negative feedback mechanisms can effectively adjust the rate of synthesis of intermediate metabolites according to the demands of the cells. This helps allocate materials and energy economically, and prevents the manufacture of excess end products. The control of enzymatic action helps to maintain a stable internal environment in living organisms.
4. Enzymes can be regulated through post-translational modification. This can include phosphorylation, myristoylation and glycosylation. For example, in the response to insulin, the phosphorylation of multiple enzymes, including glycogen synthase, helps control the synthesis or degradation of glycogen and allows the cell to respond to changes in blood sugar.[86] Another example of post-translational modification is the cleavage of the polypeptide chain. Chymotrypsin, a digestive protease, is produced in inactive form as chymotrypsinogen in the pancreas and transported in this form to the duodenum where it is activated. This stops the enzyme from digesting the pancreas or other tissues before it enters the gut. This type of inactive precursor to an enzyme is known as a zymogen.
5. Some enzymes may become activated when localized to a different environment (e.g., from a reducing (cytoplasm) to an oxidizing (periplasm) environment, high pH to low pH, etc.). For example, hemagglutinin in the influenza virus is activated by a conformational change caused by the acidic conditions, these occur when it is taken up inside its host cell and enters the lysosome.[87]

## Involvement in disease

Since the tight control of enzyme activity is essential for homeostasis, any malfunction (mutation, overproduction, underproduction or deletion) of a single critical enzyme can lead to a genetic disease. The importance of enzymes is shown by the fact that a lethal illness can be caused by the malfunction of just one type of enzyme out of the thousands of types present in our bodies.

One example is the most common type of phenylketonuria. A mutation of a single amino acid in the enzyme phenylalanine hydroxylase, which catalyzes the first step in the degradation of phenylalanine, results in build-up of phenylalanine and related products. This can lead to mental retardation if the disease is untreated.[88] Another example of enzyme deficiency is pseudocholinesterase, in which the body's ability to break down choline ester drugs is impaired.[89]

A further example is when germline mutations in genes coding for DNA repair enzymes cause hereditary cancer syndromes such as xeroderma pigmentosum. Defects in these enzymes cause cancer since the body is less able to repair mutations in the genome. This causes a slow accumulation of mutations and results in the development of many types of cancer in the sufferer.

Oral administration of enzymes can be used to treat several diseases (e.g. pancreatic insufficiency and lactose intolerance). Since enzymes are proteins themselves they are potentially subject to inactivation and digestion in the gastrointestinal environment. Therefore a non-invasive imaging assay was developed to monitor gastrointestinal activity of exogenous enzymes (prolyl endopeptidase as potential adjuvant therapy for celiac disease) in vivo.[90]

## Naming conventions

An enzyme's name is often derived from its substrate or the chemical reaction it catalyzes, with the word ending in -ase. Examples are lactase, alcohol dehydrogenase and DNA polymerase. This may result in different enzymes, called isozymes, with the same function having the same basic name. Isoenzymes have a different amino acid sequence and might be distinguished by their optimal pH, kinetic properties or immunologically. Isoenzyme and isozyme are homologous proteins. Furthermore, the normal physiological reaction an enzyme catalyzes may not be the same as under artificial conditions. This can result in the same enzyme being identified with two different names. For example, glucose isomerase, which is used industrially to convert glucose into the sweetener fructose, is a xylose isomerase in vivo (within the body).

The International Union of Biochemistry and Molecular Biology have developed a nomenclature for enzymes, the EC numbers; each enzyme is described by a sequence of four numbers preceded by "EC". The first number broadly classifies the enzyme based on its mechanism.

The top-level classification is[91]

According to the naming conventions, enzymes are generally classified into six main family classes and many sub-family classes. Some web-servers, e.g., EzyPred [92] and bioinformatics tools have been developed to predict which main family class [93] and sub-family class [94] [95] an enzyme molecule belongs to according to its sequence information alone via the pseudo amino acid composition.

## Industrial applications

Enzymes are used in the chemical industry and other industrial applications when extremely specific catalysts are required. However, enzymes in general are limited in the number of reactions they have evolved to catalyze and also by their lack of stability in organic solvents and at high temperatures. As a consequence, protein engineering is an active area of research and involves attempts to create new enzymes with novel properties, either through rational design or in vitro evolution.[96][97] These efforts have begun to be successful, and a few enzymes have now been designed "from scratch" to catalyze reactions that do not occur in nature.[98]

Application Enzymes used Uses
Food processing
Amylases from fungi and plants Production of sugars from starch, such as in making high-fructose corn syrup.[99] In baking, catalyze breakdown of starch in the flour to sugar. Yeast fermentation of sugar produces the carbon dioxide that raises the dough.
Proteases Biscuit manufacturers use them to lower the protein level of flour.
Baby foods Trypsin To predigest baby foods
Brewing industry
Enzymes from barley are released during the mashing stage of beer production. They degrade starch and proteins to produce simple sugar, amino acids and peptides that are used by yeast for fermentation.
Industrially produced barley enzymes Widely used in the brewing process to substitute for the natural enzymes found in barley.
Amylase, glucanases, proteases Split polysaccharides and proteins in the malt.
Betaglucanases and arabinoxylanases Improve the wort and beer filtration characteristics.
Amyloglucosidase and pullulanases Low-calorie beer and adjustment of fermentability.
Proteases Remove cloudiness produced during storage of beers.
Acetolactatedecarboxylase (ALDC) Increases fermentation efficiency by reducing diacetyl formation.[100]
Fruit juices Cellulases, pectinases Clarify fruit juices.
Dairy industry
Rennin, derived from the stomachs of young ruminant animals (like calves and lambs) Manufacture of cheese, used to hydrolyze protein
Microbially produced enzyme Now finding increasing use in the dairy industry
Lipases Is implemented during the production of Roquefort cheese to enhance the ripening of the blue-mold cheese.
Lactases Break down lactose to glucose and galactose.
Meat tenderizers Papain To soften meat for cooking
Starch industry
 Glucose Fructose
Amylases, amyloglucosideases and glucoamylases Converts starch into glucose and various syrups.
Glucose isomerase Converts glucose into fructose in production of high-fructose syrups from starchy materials. These syrups have enhanced sweetening properties and lower calorific values than sucrose for the same level of sweetness.
Paper industry
Amylases, Xylanases, Cellulases and ligninases Degrade starch to lower viscosity, aiding sizing and coating paper. Xylanases reduce bleach required for decolorizing; cellulases smooth fibers, enhance water drainage, and promote ink removal; lipases reduce pitch and lignin-degrading enzymes remove lignin to soften paper.
Biofuel industry
Cellulases Used to break down cellulose into sugars that can be fermented (see cellulosic ethanol)
Ligninases Use of lignin waste
Biological detergent Primarily proteases, produced in an extracellular form from bacteria Used for presoak conditions and direct liquid applications helping with removal of protein stains from clothes
Amylases Detergents for machine dish washing to remove resistant starch residues
Lipases Used to assist in the removal of fatty and oily stains
Cellulases Used in biological fabric conditioners
Contact lens cleaners Proteases To remove proteins on contact lens to prevent infections
Rubber industry Catalase To generate oxygen from peroxide to convert latex into foam rubber
Photographic industry Protease (ficin) Dissolve gelatin off scrap film, allowing recovery of its silver content.
Molecular biology
Restriction enzymes, DNA ligase and polymerases Used to manipulate DNA in genetic engineering, important in pharmacology, agriculture and medicine. Essential for restriction digestion and the polymerase chain reaction. Molecular biology is also important in forensic science.


text:
## Institute of Mathematical Statistics Collections

### On the Geometric Ergodicity of Two-Variable Gibbs Samplers

#### Abstract

A Markov chain is geometrically ergodic if it converges to its invariant distribution at a geometric rate in total variation norm. We study geometric ergodicity of deterministic and random scan versions of the two-variable Gibbs sampler. We give a sufficient condition which simultaneously guarantees both versions are geometrically ergodic. We also develop a method for simultaneously establishing that both versions are subgeometrically ergodic. These general results allow us to characterize the convergence rate of two-variable Gibbs samplers in a particular family of discrete bivariate distributions.

#### Chapter information

Source
Galin Jones and Xiaotong Shen, eds., Advances in Modern Statistical Theory and Applications: A Festschrift in honor of Morris L. Eaton, (Beachwood, Ohio, USA: Institute of Mathematical Statistics, 2013) , 25-42

Dates
First available in Project Euclid: 23 September 2013

http://projecteuclid.org/euclid.imsc/1379942046

Digital Object Identifier
doi:10.1214/12-IMSCOLL1002

Subjects
Primary: 60J10: Markov chains (discrete-time Markov processes on discrete state spaces)
Secondary: 62F15: Bayesian inference

Rights

#### Citation

Tan, Aixin; Jones, Galin L.; Hobert, James P. On the Geometric Ergodicity of Two-Variable Gibbs Samplers. Advances in Modern Statistical Theory and Applications: A Festschrift in honor of Morris L. Eaton, 25--42, Institute of Mathematical Statistics, Beachwood, Ohio, USA, 2013. doi:10.1214/12-IMSCOLL1002. http://projecteuclid.org/euclid.imsc/1379942046.

#### References

• Chan, K. S. and Geyer, C. J. (1994). Comment on “Markov Chains for exploring posterior distributions”. The Annals of Statistics 22 1747–1758.
• Diaconis, P., Khare, K. and Saloff-Coste, L. (2008). Gibbs sampling, exponential families and orthogonal polynomials. Statistical Science 23 151–178.
• Flegal, J. M., Haran, M. and Jones, G. L. (2008). Markov chain Monte Carlo: Can we trust the third significant figure? Statistical Science 23 250–260.
• Flegal, J. M. and Jones, G. L. (2010). Batch means and spectral variance estimators in Markov chain Monte Carlo. The Annals of Statistics 38 1034-1070.
• Flegal, J. M. and Jones, G. L. (2011). Implementing Markov chain Monte Carlo: Estimating with confidence. In Handbook of Markov Chain Monte Carlo ( S. Brooks, A. Gelman, G. L. Jones and X.-L. Meng, eds.) 175–197. CRC Press, Boca Raton, FL.
• Geyer, C. J. (1992). Practical Markov chain Monte Carlo. Statistical Science 7 473-511.
• Geyer, C. J. (2011). Introduction to Markov chain Monte Carlo. In Handbook of Markov Chain Monte Carlo ( S. P. Brooks, A. Gelman, G. L. Jones and X.-L. Meng, eds.) 3–48. CRC Press, Boca Raton, FL.
• Hobert, J. P. (2011). The data augmentation algorithm: Theory and methodology. In Handbook of Markov Chain Monte Carlo ( S. P. Brooks, A. Gelman, G. L. Jones and X.-L. Meng, eds.) 253–293. CRC Press, Boca Raton, FL.
• Hobert, J. P. and Geyer, C. J. (1998). Geometric ergodicity of Gibbs and block Gibbs samplers for a hierarchical random effects model. Journal of Multivariate Analysis 67 414-430.
• Hobert, J. P., Jones, G. L., Presnell, B. and Rosenthal, J. S. (2002). On the applicability of regenerative simulation in Markov chain Monte Carlo. Biometrika 89 731–743.
• Johnson, A. A. (2009). Geometric Ergodicity of Gibbs Samplers PhD thesis, University of Minnesota, School of Statistics.
• Johnson, A. A. and Jones, G. L. (2010). Gibbs sampling for a Bayesian hierarchical version of the general linear mixed model. Electronic Journal of Statistics 4 313–333.
• Johnson, A. A., Jones, G. L. and Neath, R. C. (2011). Component-wise Markov chain Monte Carlo Technical Report, University of Minnesota, School of Statistics.
• Jones, G. L. (2004). On the Markov chain central limit theorem. Probability Surveys 1 299–320.
• Jones, G. L. and Hobert, J. P. (2001). Honest exploration of intractable probability distributions via Markov chain Monte Carlo. Statistical Science 16 312–334.
• Jones, G. L. and Hobert, J. P. (2004). Sufficient burn-in for Gibbs samplers for a hierarchical random effects model. The Annals of Statistics 32 784–817.
• Jones, G. L., Haran, M., Caffo, B. S. and Neath, R. (2006). Fixed-width output analysis for Markov chain Monte Carlo. Journal of the American Statistical Association 101 1537–1547.
• Liu, J. S., Wong, W. H. and Kong, A. (1994). Covariance structure of the Gibbs sampler with applications to the comparisons of estimators and augmentation schemes. Biometrika 81 27–40.
• Liu, J. S., Wong, W. H. and Kong, A. (1995). Covariance structure and convergence rate of the Gibbs sampler with various scans. Journal of the Royal Statistical Society, Series B 57 157–169.
• Marchev, D. and Hobert, J. P. (2004). Geometric ergodicity of van Dyk and Meng’s algorithm for the multivariate Student’s $t$ model. Journal of the American Statistical Association 99 228–238.
• Meyn, S. P. and Tweedie, R. L. (1993). Markov Chains and Stochastic Stability. Springer-Verlag, London.
• Robert, C. P. (1995). Convergence control methods for Markov chain Monte Carlo algorithms. Statistical Science 10 231–253.
• Roberts, G. O. and Polson, N. G. (1994). On the geometric convergence of the Gibbs sampler. Journal of the Royal Statistical Society, Series B 56 377–384.
• Roberts, G. O. and Rosenthal, J. S. (1997). Geometric ergodicity and hybrid Markov chains. Electronic Communications in Probability 2 13-25.
• Roberts, G. O. and Rosenthal, J. S. (1999). Convergence of slice ampler Markov chains. Journal of the Royal Statistical Society, Series B 61 643–660.
• Roberts, G. O. and Rosenthal, J. S. (2001). Markov chains and de-initializing processes. Scandinavian Journal of Statistics 28 489–504.
• Roberts, G. O. and Rosenthal, J. S. (2004). General state space Markov chains and MCMC algorithms. Probability Surveys 1 20–71.
• Román, J. C. (2012). Convergence Analysis of Block Gibbs Samplers for Bayesian General Linear Mixed Models PhD thesis, Department of Statistics, University of Florida.
• Román, J. C. and Hobert, J. P. (2011). Convergence analysis of the Gibbs sampler for Bayesian general linear mixed models with improper priors. Technical Report, University of Florida, Department of Statistics.
• Rosenthal, J. S. (1996). Analysis of the Gibbs sampler for a model related to James-Stein estimators. Statistics and Computing 6 269–275.
• Roy, V. and Hobert, J. P. (2007). Convergence rates and asymptotic standard errors for Markov chain Monte Carlo algorithms for Bayesian probit regression. Journal of the Royal Statistical Society, Series B 69 607–623.
• Tan, A. and Hobert, J. P. (2009). Block Gibbs sampling for Bayesian random effects models with improper priors: Convergence and regeneration. Journal of Computational and Graphical Statistics 18 861–878.
• Tanner, M. A. and Wong, W. H. (1987). The calculation of posterior distributions by data augmentation. Journal of the American Statistical Association 82 528–550.
• Tierney, L. (1994). Markov chains for exploring posterior distributions. The Annals of Statistics 22 1701-1762.

format: plain


text:
# Segmenting F1 Qualifying Session Laptimes

I’ve started scraping some FIA timing sheets again, including practice and qualifying session laptimes. One of the things I’d like to do is explore various ways of looking at the qualifying session laptimes, which means identifying which qualifying session each laptime falls into, using some sort of clustering algorithm… or other means…:

For looking at session utilisation charts I’ve been making use of accumulated time into session to help display the data, as the following session utilisation chart (including green and purple laptimes) shows:

The horizontal x-axis is time into session from a basetime of the first time-of-day timestamp recorded on the timing sheets for the session.

If we look at the distribution of qualifying session laptimes for the 2015 Malaysian Grand Prix, we get something like this:

We can see a big rain delay gap, and also a tighter gap between the first and second sessions.

If we try to run a k-means clustering algorithm on the data, using 3 means for the three sessions, we see that in this case it isn’t managing to cluster the laptimes into actual sessions:

# Attempt to identify qualifying session using K-Means Cluster Analysis around 3 means
clusters &amp;lt;- kmeans(f12015test['cuml'], 3)

f12015test = data.frame(f12015test, clusters$cluster) ggplot(f12015test)+geom_text(aes(x=cuml, y=stime, label=code, colour=factor(clusters.cluster)) ,angle=45,size=3) In particular, so of the Q1 laptimes are being grouped with Q2 laptimes. However, we know that there is at least a 2 minute gap between sessions (regulations suggest 7 minutes, though if this is the time between lights going red then green again, we might need to knock a couple of minutes off the gap to account to for drivers who start their last lap just before the lights go red on a session) so if we assume that the only times there will be a two minute gap between recorded laptimes during the whole of qualifying session will be in the periods between the qualifying sessions, we can can generate a flag on those gaps, and then generate session number counts by counting on those flags. #Look for a two minute gap f12015test=arrange(f12015test,cuml) f12015test['gap']=c(0,diff(f12015test[,'cuml'])) f12015test['gapflag']= (f12015test['gap']&amp;gt;=120) f12015test['qsession']=1+cumsum(f12015test[,'gapflag']) ggplot(f12015test)+ geom_text(aes(x=cuml, y=stime, label=code), angle=45,size=3 +facet_wrap(~qsession, scale=&amp;quot;free&amp;quot;)  (To tighten this up, we might also try to factor in the number of cars in the pits at any particular point in time…) This chart clearly shows how the first qualifying session saw cars trialling evenly throughout the session, whereas in Q2 and Q3 they were far more bunched up (which perhaps creates more opportunities for cars to get in each others’ way on flying laps…) One of the issues with this chart is that we don’t get to zoom in to actual flying laps. If all the flying lap times were about the same time, we could simply generate y-axis limits based on purple laptimes: minl=min(f12015test$purple)*0.95
maxl=min(f12015test\$purple)*1.3

#Use these values in ylim()...

However, where the laptimes differ significantly across sessions as they do in this case due to a dramatic change in weather conditions, we probably need to filter the data for each session separately.

Another crib we might use is to identify PIT lap and out-laps (laps immediately following a PIT event) and filter those out of the laptime traces.

Versions of these recipes will soon be added to the Wrangling F1 Data With R book. Once you buy into the book, you get all future updates to it for no additional cost, even in the case of the minimum book price increasing over time.

# Rediscovering Formula One Race Battlemaps

A couple of days ago, I posted a recipe on the F1DataJunkie blog that described how to calculate track position from laptime data.

Using that information, as well as additional derived columns such as the identity of, and time to, the cars immediately ahead of and behind a particular selected driver, both in terms of track position and race position, I revisited a chart type I first started exploring several years ago – race battle charts.

The main idea behind the battlemaps is that they can help us search for stories amidst the runners.

dirattr=function(attr,dir='ahead') paste(attr,dir,sep='')

#We shall find it convenenient later on to split out the initial data selection
battlemap_df_driverCode=function(driverCode){
lapTimes[lapTimes['code']==driverCode,]
}

car_X=dirattr('car_',dir)
code_X=dirattr('code_',dir)
factor_X=paste('factor(position_',dir,'<position)',sep='')
code_race_X=dirattr('code_race',dir)

g=g+geom_hline(aes_string(yintercept=drs),linetype=5,col='grey')

#Plot the offlap cars that aren't directly being raced
g=g+geom_text(data=df[df[dirattr('code_',dir)]!=df[dirattr('code_race',dir)],],
aes_string(x='lap',
y=car_X,
label=code_X,
col=factor_X),
angle=45,size=2)
#Plot the cars being raced directly
g=g+geom_text(data=df,
aes_string(x='lap',
y=diff_X,
label=code_race_X),
angle=45,size=2)
g+guides(col=guide_legend(title='Intervening car'))

}

battle_WEB=battlemap_df_driverCode('WEB')
battlemap_core_chart(battle_WEB,g,dir='behind')

In this first sketch, from the 2012 Australian Grand Prix, I show the battlemap for Mark Webber:

We see how at the start of the race Webber kept pace with Alonso, albeit around about a second behind, at the same time as he drew away from Massa. In the last third of the race, he was closely battling with Hamilton whilst drawing away from Alonso. Coloured labels are used to highlight cars on a different lap (either ahead (aqua) or behind (orange)) that are in a track position between the selected driver and the car one place ahead or behind in terms of race position (the black labels). The y-axis is the time delta in milliseconds between the selected car and cars ahead (y > 0) or behind (y < 0). A dashed line at the +/- one second mark identifies cars within DRS range.

As well as charting the battles in the vicinity of a particular driver, we can also chart the battle in the context of a particular race position. We can reuse the chart elements and simply need to redefine the filtered dataset we are charting.

For example, if we filter the dataset to just get the data for the car in third position at the end of each lap, we can then generate a battle map of this data.

battlemap_df_position=function(position){
lapTimes[lapTimes['position']==position,]
}

battleForThird=battlemap_df_position(3)

g=battlemap_core_chart(battleForThird,ggplot(),dir='behind')+xlab(NULL)+theme_bw()
g

For more details, see the original version of the battlemap chapter. For updates to the chapter, I recommend that you invest in a copy Wrangling F1 Data With R book if you haven’t already done so:-)

# Connecting RStudio and MySQL Docker Containers – an example using the ergast db

building on Dockerising Open Data Databases – First Fumblings and my Book Extras – Data Files, Code Files and a Dockerised Application, I just figured out how to get the ergast db into a MySQL docker container and then query it from RStudio:

• install these docker-mysql-scripts
• run boot2docker
• from the boot2docker shell, start up a MySQL server (ergastdb) with password f1: dmysql-server ergastdb f1 By default, this exposes port 3306
• create an new empty database (f1db): dmysql-create-database ergastdb f1db
• add the ergast data to it: dmysql-import-database ergastdb /path/to/ergastdb/f1db.sql --database f1db
• fire up a copy of RStudio, in this case using my psychemedia/wranglingf1data container, linking it to the MySQL database which has the alias db: docker run --name f1djd -p 8788:8787 --link ergastdb:db -d psychemedia/wranglingf1data
• in RStudio, import the RMySQL library: library(RMySQL)
• in RStudio, connect to the database: con=dbConnect(MySQL(),user='root',password='f1',host='db',port=3306,dbname='f1db')
• in RStudio, run a test query: dbQuery(con,'SHOW TABLES');

I guess what I need to do now is pull the various bits into another script to make it a one-liner, perhaps with a few switches? For example, to create the database if it doesn’t exist, to download the ergast database file automatically, to populate the database for the first time, or update it with a more recent copy of the database, to fire up both containers and make sure they are appropriately linked etc. This would dramatically simplify things for use in the context of the Wrangling F1 Data With R book, for example. (If you beat me to it, please post details in the comments below.)

PS Hmm…. seems I get a UTF-8 encoding issue:

Not sure if this is with the database, or the RMySQL connector? Anyone got any ideas of a fix?

Ah ha – sort of via SO:

Running dbGetQuery(con,'SET NAMES utf8;') before querying seems to do the trick…

# Calculating Churn in Seasonal Leagues

One of the things I wanted to explore in the production of the Wrangling F1 Data With R book was the extent to which I could draw on published academic papers for inspiration in exploring the the various results and timing datasets.

In a chapter published earlier this week, I explored the notion of churn, as described in Mizak, D, Neral, J & Stair, A (2007) The adjusted churn: an index of competitive balance for sports leagues based on changes in team standings over time. Economics Bulletin, Vol. 26, No. 3 pp. 1-7, and further appropriated by Berkowitz, J. P., Depken, C. A., & Wilson, D. P. (2011). When going in circles is going backward: Outcome uncertainty in NASCAR. Journal of Sports Economics, 12(3), 253-283.

In a competitive league, churn is defined as:

$C_t = \frac{\sum_{i=1}^{N}\left|f_{i,t} - f_{i,t-1}\right|}{N}$

where $C_t$ is the churn in team standings for year $t$, $\left|f_{i,t} - f_{i,t-1}\right|$ is the absolute value of the $i$-th team’s change in finishing position going from season $t-1$ to season $t$, and $N$ is the number of teams.

The adjusted churn is defined as an indicator with the range 0..1 by dividing the churn, $C_t$, by the maximum churn, $C_max$. The value of the maximum churn depends on whether there is an even or odd number of competitors:

$C_{max} = N/2 \text{, for even N}$

$C_{max} = (N^2 - 1) / 2N \text{, for odd N}$

Berkowitz et al. reconsidered churn as applied to an individual NASCAR race (that is, at the event level). In this case, $f_{i,t}$ is the position of driver $i$ at the end of race $t$, $f_{i,t-1}$ is the starting position of driver $i$ at the beginning of that race (that is, race $t$) and $N$ is the number of drivers participating in the race. Once again, the authors recognise the utility of normalising the churn value to give an *adjusted churn* in the range 0..1 by dividing through by the maximum churn value.

Using these models, I created churn function of the form:

is.even = function(x) x %% 2 == 0
churnmax=function(N)
if (is.even(N)) return(N/2) else return(((N*N)-1)/(2*N))

churn=function(d) sum(d)/length(d)
adjchurn = function(d) churn(d)/churnmax(length(d))

and then used it to explore churn in a variety of contexts:

• comparing grid positions vs race classifications across a season (cf. Berkowitz et al.)
• churn in Drivers’ Championship standings over several seasons (cf. Mizak et al.)
• churn in Constructors’ Championship standings over several seasons (cf. Mizak et al.)

For example, in the first case, we can process data from the ergast database as follows:

library(DBI)
ergastdb = dbConnect(RSQLite::SQLite(), './ergastdb13.sqlite')

q=paste('SELECT round, name, driverRef, code, grid,
position, positionText, positionOrder
FROM results rs JOIN drivers d JOIN races r
ON rs.driverId=d.driverId AND rs.raceId=r.raceId
WHERE r.year=2013',sep='')
results=dbGetQuery(ergastdb,q)

library(plyr)
results['delta'] =  abs(results['grid']-results['positionOrder'])
churn.df = ddply(results[,c('round','name','delta')], .(round,name), summarise,
churn = churn(delta),
)

For more details, see this first release of the Keeping an Eye on Competitiveness – Tracking Churn chapter of the Wrangling F1 Data With R book.

# Information Density and Custom Chart Designs

I’ve been doodling today with a some charts for the Wrangling F1 Data With R living book, trying to see how much information I can start trying to pack into a single chart.

The initial impetus came simply from thinking about a count of laps led in a particular race by each drive; this morphed into charting the number of laps in each position for each driver, and then onto a more comprehensive race summary chart (see More Shiny Goodness – Tinkering With the Ergast Motor Racing Data API for an earlier graphical attempt at producing a race summary chart).

The chart shows:

grid position: identified using an empty grey square;
race position after the first lap: identified using an empty grey circle;
race position on each driver’s last lap: y-value (position) of corresponding pink circle;
points cutoff line: a faint grey dotted line to show which positions are inside – or out of – the points;
number of laps completed by each driver: size of pink circle;
total laps completed by driver: greyed annotation at the bottom of the chart;
whether a driver was classified or not: the total lap count is displayed using a bold font for classified drivers, and in italics for unclassified drivers;
finishing status of each driver: classification statuses other than *Finished* are also recorded at the bottom of the chart.

The chart also shows drivers who started the race but did not complete the first lap.

What the chart doesn’t show is what stage of the race the driver was in each position, and how long for. But I have an idea for another chart that could help there, as well as being able to reuse elements used in the chart shown here.

FWIW, the following fragment of R code shows the ggplot function used to create the chart. The data came from the ergast API, though it did require a bit of wrangling to get it into a shape that I could use to power the chart.

#Reorder the drivers according to a final ranked position
g=ggplot(finalPos,aes(x=reorder(driverRef,finalPos)))
#Highlight the points cutoff
g=g+geom_hline(yintercept=10.5,colour='lightgrey',linetype='dotted')
#Highlight the position each driver was in on their final lap
g=g+geom_point(aes(y=position,size=lap),colour='red',alpha=0.15)
#Highlight the grid position of each driver
g=g+geom_point(aes(y=grid),shape=0,size=7,alpha=0.2)
#Highlight the position of each driver at the end of the first lap
g=g+geom_point(aes(y=lap1pos),shape=1,size=7,alpha=0.2)
#Provide a count of how many laps each driver held each position for
g=g+geom_text(data=posCounts,
aes(x=driverRef,y=position,label=poscount,alpha=alpha(poscount)),
size=4)
#Number of laps completed by driver
g=g+geom_text(aes(x=driverRef,y=-1,label=lap,fontface=ifelse(is.na(classification), 'italic' , 'bold')),size=3,colour='grey')
#Record the status of each driver
g=g+geom_text(aes(x=driverRef,y=-2,label=ifelse(status!='Finished', status,'')),size=2,angle=30,colour='grey')
#Styling - tidy the chart by removing the transparency legend
g+theme_bw()+xRotn()+xlab(NULL)+ylab("Race Position")+guides(alpha=FALSE)

The fully worked code can be found in forthcoming update to the Wrangling F1 Data With R living book.

# F1 Championship Race, 2014 – Winning Combinations…

As we come up to the final two races of the 2014 Formula One season, the double points mechanism for the final race means that two drivers are still in with a shot at the Drivers’ Championship: Lewis Hamilton and Nico Rosberg.

As James Allen describes in Hamilton closes in on world title: maths favour him but Abu Dhabi threat remains:

Hamilton needs 51 points in the remaining races to be champion if Rosberg wins both races. Hamilton can afford to finish second in Brazil and at the double points finale in Abu Dhabi and still be champion. Mathematically he could also finish third in Brazil and second in the finale and take it on win countback, as Rosberg would have just six wins to Hamilton’s ten.
If Hamilton leads Rosberg home again in a 1-2 in Brazil, then he will go to Abu Dhabi needing to finish fifth or higher to be champion (echoes of Brazil 2008!!). If Rosberg does not finish in Brazil and Hamilton wins the race, then Rosberg would need to win Abu Dhabi with Hamilton not finishing; no other scenario would give Rosberg the title.

A couple of years ago, I developed an interactive R/shiny app for exploring finishing combinations of two drivers in the last two races of a season to see what situations led to what result: Interactive Scenarios With Shiny – The Race to the F1 2012 Drivers’ Championship.

I’ve updated the app (taking into account the matter of double points in the final race) so you can check out James Allen’s calculations with it (assuming I got my sums right too!). I tried to pop up an interactive version to Shinyapps, but the Shinyapps publication mechanism seems to be broken (for me at least) at the moment…:-(

In the meantime, if you have RStudio installed, you can run the application yourself. The code is avaliable and can be run from RStudio with: runGist("81380ff09ebe1cd67005")

When I get a chance, I’ll weave elements of this recipe into the Wrangling F1 Data With R book.

PS I’ve also started using the F1dataJunkie blog again as a place to post drafts and snippets of elements I’m working on for that book…

# Wrangling F1 Data With R – F1DataJunkie Book

Earlier this year I started trying to pull together some of my #f1datajunkie R-related ramblings together in a book form. The project stalled, but to try to reboot it I’ve started publishing it as a living book over on Leanpub. Several of the chapters are incomplete – with TO DO items sketched in, others are still unpublished. The beauty of the Leanpub model is that if you buy a copy, you continue to get access to all future updated versions of the book. (And my idea is that by getting the book out there as it is, I’ll feel as if there’s more (social) pressure on actually trying to keep up with it…)

I’ll be posting more details about how the Leanpub process works (for me at least) in the next week or two, but for now, here’s a link to the book: Wrangling F1 Data With R: A Data Junkie’s Guide.

• Foreword
• A Note on the Data Sources
• Introduction
• Preamble
• What are we trying to do with the data?
• Choosing the tools
• The Data Sources
• Getting the Data into RStudio
• Example F1 Stats Sites
• How to Use This Book
• The Rest of This Book…
• An Introduction to RStudio and R dataframes
• Getting Started with RStudio
• Getting Started with R
• Summary
• Getting the data from the Ergast Motor Racing Database API
• Accessing Data from the ergast API
• Summary
• Accessing SQLite from R
• Asking Questions of the ergast Data
• Summary
• Exercises and TO DO
• Data Scraped from the F1 Website
• Problems with the Formula One Data
• How to use the FormulaOne.com alongside the ergast data
• Reviewing the Practice Sessions
• The Weekend Starts Here
• Practice Session Data from the FIA
• Sector Times
• FIA Media Centre Timing Sheets
• A Quick Look at Qualifying
• Qualifying Session Position Summary Chart
• Another Look at the Session Tables
• Ultimate Lap Positions
• Lapcharts
• Annotated Lapcharts
• Race History Charts
• The Simple Laptime Chart
• Accumulated Laptimes
• The Lapalyzer Session Gap
• Eventually: The Race History Chart
• Pit Stop Analysis
• Pit Stop Data
• Total pit time per race
• Pit Stops Over Time
• Estimating pit loss time
• Tyre Change Data
• Career Trajectory
• The Effect of Age on Performance
• Statistical Models of Career Trajectories
• Summary
• Streakiness
• Spotting Runs
• Generating Streak Reports
• Streak Maps
• Team Streaks
• Time to N’th Win
• TO DO
• Summary
• Conclusion
• Appendix One – Scraping formula1.com Timing Data
• Appendix Two – FIA Timing Sheets


text:
# SlidingWindowObjectDetector¶

## What is this?¶

This nodelet performs supervised object detection through binary support vector machine trained object classifier.

The Nodelet uses a sliding window detection method as a raster scaning of the image.

Currently, the detector is trained on Histogram of Oriented Gradients and HS Color histogram.

To train this detector please use the custom implemented jsk_perception/sliding_window_object_detector_trainer_node node bundled in jsk_perception pkg.

This manifest file contains specific configurations of the trainer, the feature dimensionalities, the detector window size and the output directories with filenames.

## Usage¶

The nodelet can be configured to run as either:

• 1) a detector (DETECTOR)

The nodelet simply loads the manifest and trainer and performs object detection.

• 2) a bootstraper (BOOTSTRAPER)

This mode, is used to refine the trained classifier by accumulating the false positive detection in the environment to re-train the detector.

This method helps reduce the false positives.

Note when doing bootstrapping make sure that the object of interest is NOT in the environment.

The nodelet before doing bootstrapping will load the negative training bag file, read, and will write using the same name and will append the images from bootstrapping to the bag.

This is done to set all training set to similar time stamps.

## Subscribing Topic¶

• ~input (sensor_msgs/Image)

Input image.

## Publishing Topic¶

• ~output/image (sensor_msgs/Image)

Raw image marked with bounding boxes of detected objects.

• ~output/rects (jsk_recognition_msgs/RectArray)

Array of detected bounding boxes

## Parameters¶

• ~run_type (string, required)

Run the nodelet as a detector or bootstraper. See above.

• ~trainer_manifest (string, default: sliding_window_trainer_manifest.xml)

Manifest file containing training parameters, which is one of outputs of sliding_window_object_detector_trainer_node.

• override_manifest (bool, default: false)

Override parameters shown below after loading ~trainer_manifest.

Overridable parameters are …

• ~trainer_path (string)

Trained SVM model.

• ~swindow_x (int)

• ~swindow_y (int)

Kernel size of sliding window.

• ~dataset_path (string)

Path to directory which contains dataset rosbag files.

It should end with /.

• ~object_dataset_filename (string)

• ~nonobject_dataset_filename (string)

Rosbag file name of the object/background training set.

• ~image_downsize (Int, default: 2)

Reduces the image by this factor. (Smaller image dimensions makes processing faster)

This parameter can be changed by dynamic_reconfigure.

• ~scaling_factor (float, default: -0.06)

Scale factor for pyramidical scaling of the window. + value indices increase while - reduce.

This parameter can be changed by dynamic_reconfigure.

• ~stack_size (int, default: 2)

Spefices the number of times a window is to be changed for raster scanning.

The changed factor for each traversal is determined by ~scaling_factor

This parameter can be changed by dynamic_reconfigure.

• ~sliding_window_increment (int, default: 16)

Spefices the number of pixels to shift the window for next detection (a.k.a. stride).

This parameter can be changed by dynamic_reconfigure.

Note that these parameters are critical in determining the detection rate and the speed of execution. Please fine tune the parameters accordingly to get the best performance.

## Sample¶

roslaunch jsk_perception sample_sliding_window_object_detector.launch