Sphinx-4
|
|
Sphinx-4 Links
SourceForge
|
General InformationInstallationDemosSphinx-4 in Detail
|
Sphinx-4 is a state-of-the-art speech recognition system written entirely in the JavaTM programming language. It was created via a joint collaboration between the Sphinx group at Carnegie Mellon University, Sun Microsystems Laboratories, Mitsubishi Electric Research Labs (MERL), and Hewlett Packard (HP), with contributions from the University of California at Santa Cruz (UCSC) and the Massachusetts Institute of Technology (MIT).
Sphinx-4 started out as a port of Sphinx-3 to the Java(TM) programming language, but evolved into a recognizer designed to be much more flexible than Sphinx-3, thus becoming an excellent platform for speech research.
Live mode and batch mode speech recognizers, capable of recognizing discrete and continuous speech.
Generalized pluggable front end architecture. Includes pluggable implementations of preemphasis, Hamming window, FFT, Mel frequency filter bank, discrete cosine transform, cepstral mean normalization, and feature extraction of cepstra, delta cepstra, double delta cepstra features.
Generalized pluggable language model architecture. Includes pluggable language model support for ASCII and binary versions of unigram, bigram, trigram, Java Speech API Grammar Format (JSGF), and ARPA-format FST grammars.
Generalized acoustic model architecture. Includes pluggable support for Sphinx-3 acoustic models.
Generalized search management. Includes pluggable support for breadth first and word pruning searches.
Speech tools. Includes tools for displaying waveforms and spectrograms and generating features from audio.
(NOTE: The links in this section point to local files created by javadoc. If they are broken, please follow the instructions on Creating Javadocs to create these links.)
Sphinx-4 is a very flexible system capable of performing many different types of recognition tasks. As such, it is difficult to characterize the performance and accuracy of Sphinx-4 with just a few simple numbers such as speed and accuracy. Instead, we regularly run regression tests on Sphinx-4 to determine how it performs under a variety of tasks. These tasks and their latest results are as follows (each task is progressively more difficult than the previous task):
The following table compares the performance of Sphinx 3.3 with Sphinx-4.
| Test | S3.3 WER | S4 WER | S3.3 RT | S4 RT(1) | S4 RT (2) | Vocabulary Size | Language Model |
|---|---|---|---|---|---|---|---|
| TI46 | 1.217 | 0.168 | 0.14 | .03 | .02 | 11 | isolated digits recognition |
| TIDIGITS | 0.661 | 0.549 | 0.16 | 0.07 | 0.05 | 11 | continuous digits |
| AN4 | 1.300 | 1.192 | 0.38 | 0.25 | 0.20 | 79 | trigram |
| RM1 | 2.746 | 2.739 | 0.50 | 0.50 | 0.40 | 1,000 | trigram |
| WSJ5K | 7.323 | 7.174 | 1.36 | 1.22 | 0.96 | 5,000 | trigram |
| HUB4 | 18.845 | 18.878 | 3.06 | ~4.4 | 3.8 | 60,000 | trigram |
This data was collected on a dual CPU UltraSPARC-III running at 1015 MHz with 2G of memory.
Sphinx-4 has been built and tested on the Solaris TM Operating Environment, Mac OS X, Linux and Win32 operating systems. Running, building, and testing Sphinx-4 requires additional software. Before you start, you will need the following software available on your machine.
set JAVA_HOME=c:\j2sdk1.4.2 set ANT_HOME=c:\ant set PATH=%PATH%;%ANT_HOME%\bin;%JAVA_HOME%\bin
export JAVA_HOME=/usr/java/j2sdk1.4.2 export ANT_HOME=/usr/local/ant export PATH=${PATH}:${ANT_HOME}/bin:${JAVA_HOME}/bin
setenv JAVA_HOME /usr/java/j2sdk1.4.2 setenv ANT_HOME /usr/local/ant setenv PATH ${PATH}:${ANT_HOME}/bin:${JAVA_HOME}/bin
Sphinx-4 has two packages available for download:
After you have downloaded these files, unjar the ZIP files using the
jar
command which is in the bin
directory of
your Java installation:
jar xvf sphinx4-{version}-bin.zip jar xvf sphinx4-{version}-src.zip
For both downloads, a directory called "sphinx4-{version}" will be created.
There are also the RM1 acoustic model, and HUB4 acoustic and language models, available for download at the same location on SourceForge. Download them only if you want to run the regression tests for RM1 and HUB4.
If you want to be able to get the latest updates from the CVS source tree, you should retrieve the code from the CVS source tree on SourceForge. The Sphinx-4 code is located at sourceforge.net as open source. Please follow the instructions below to retrieve it.
% export CVS_RSH=ssh % cvs -z3 -d:ext:developername@cvs.sourceforge.net:/cvsroot/cmusphinx co sphinx4where developername is your sourceforge developer name.
% cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/cmusphinx login % cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/cmusphinx co sphinx4
Since the sphinx4-{version}-bin.zip distribution does not contain the source code, you must download the sphinx4-{version}-src.zip, or retrieved the code from SourceForge using CVS, in order to be able to build from the sources. The software required for building Sphinx-4 are listed in the Required Software section.
Setup JSAPI 1.0
Before you build Sphinx-4, it is important to setup your JSAPI environment, because a number of tests and demos rely on having JSAPI installed.
To build Sphinx-4, at the command prompt change to
the directory where you installed Sphinx-4 (usually, a simple
"cd sphinx4" will do). Set your JAVA_HOME
,
ANT_HOME
and PATH
environment variables
as described above. Then type the following:
ant
This executes the Apache Ant
command to build the Sphinx-4 classes under the bld
directory, the jar files under the lib
directory,
and the demo jar files under the bin
directory.
To delete all the output from the build to give you a fresh start:
ant clean
The javadocs have already been built if you downloaded the sphinx4-{version}-bin.zip. In order to build the javadocs yourself, you must download the sphinx4-{version}-src.zip distribution instead. To build the javadocs, go to the top level directory ("sphinx4-{version}"), and type:
ant javadoc
This will build javadocs from public classes, displaying only the public methods and fields. In general, this is all the information you will need. If you need more details, such as private or protected classes, you can generate the corresponding javadoc by doing, for example:
ant -Daccess=private javadoc
setenv JAVA_HOME /lab/speech/java/j2sdk1.4.0
export JAVA_HOME='/lab/speech/java/jdk1.4.1_01'
export JAVA_HOME='c:/Progra~1/J2SDK_Forte/jdk1.4.0'
setenv CVS_RSH ssh
export CVS_RSH='/usr/local/bin/ssh'
export CVS_RSH='ssh'
d:\work\sphinx4>ant clean /c: Can't open /c: No such file or directory
Sphinx-4 contains a number of demo programs. If you downloaded the binary distribution (sphinx4-{version}-bin.zip), the JAR files of the demos are already built, so you can just run them directly. However, if you downloaded the source distribution (sphinx4-{version}-src.zip or via CVS), you need to build the demos. Click on the links below for instructions on how to build and run the demos.
There is also a live-mode test program (this link only works if you downloaded the source distribution), which is available if you download the sphinx-src-{version}.zip file but not available in the sphinx-bin-{version}.zip file.
The AudioTool is a visual tool that records and displays the waveform and spectrogram of an audio signal. It is available in both the binary and source releases.
The document Sphinx-4 Configuration Management describes, in detail, how to configure a Sphinx-4 system.
The document Sphinx-4 Instrumentation describes, in detail, how to use the instrumentation facilities of the Sphinx-4 system.
Sphinx-4 contains a number of regression tests using common speech databases. Again, you have to download the source distribution or downloaded the source tree using CVS in order to get the regression tests directory. The regression tests we have are:
Before you run any of the tests, make sure that you have built Sphinx-4 already. To do so, go to the top level and type:
ant
You also need to make sure you have the appropriate acoustic model(s) installed. More details below.
The Sphinx-4 regression tests have different directories for the different tasks. The directory sphinx4/tests/performance contains directories named ti46, tidigits, an4, rm1, hub4, and some other tests. Each of these directories contains a build.xml with targets specific to the particular task. The build.xml allows you to run a number of different tests. Type:
ant -projecthelpto list a help text with the possible targets.
The TIDIGITS models are already included as part of the distribution. Therefore, you do not need to download them separately. You must have the TI46 test data, available from the LDC TI46 website.
You need to edit the batch file called ti46.batch
,
located in tests/performance/ti46
directory.
You will need to change it such that
it matches where you stored the TI46 test files. Refer to the section
Batch Files for detail about the format of
batch files.
To run the tests:
% cd sphinx4/tests/performance/ti46 % ant -projecthelp # to see a list of possible targets % ant ti46_wordlist
The TIDIGITS models are already included as part of the distribution. Therefore, you do not need to download them separately.
You must have the TIDIGITS test data, available from the LDC TIDIGITS website.
You need to edit the batch file called tidigits.batch
,
located in the tests/performance/tidigits
directory.
You will need to change it such that
it matches where you stored the TIDIGITS test files. Refer to the section
Batch Files for detail about the format of
batch files.
To run the tests:
% cd sphinx4/tests/performance/tidigits % ant -projecthelp # to see a list of possible targets % ant tidigits_flat_unigram
The Wall Street Journal (WSJ) models are already included as part of the distribution. Therefore, you do not need to download them separately.
Download the big endian raw audio format of the AN4 Database. Unpack it at a directory of your choice:
% gunzip an4_raw.bigendian.tar.gz % tar -xvf an4_raw.bigendian.tar
Then update the following batch files (located in the
tests/performance/an4
directory), so that they match up with where you unpacked the AN4 data.
You probably just need to replace all instances of the string
"/lab/speech/sphinx4/data"
inside these batch files.
Please refer to the Batch Files section for
details about batch files:
an4_full.batch
an4_spelling.batch
an4_words.batch
After you have updated the batch files, you can run the tests by:
% cd sphinx4/tests/performance/an4 % ant -projecthelp # to see a list of possible targets % ant an4_words_unigram
Make sure that you have downloaded the binary RM1 model file, called
RM1_13dCep_16k_40mel_130Hz_6800Hz.jar
, located at the
sphinx4
package in the downloads page.
Then in the build file for the RM1 tests,
sphinx4/tests/performance/rm1/build.xml
,
changed the classpath
property of the build file to point to
the location of your RM1_13dCep_16k_40mel_130Hz_6800Hz.jar
.
You must have the RM1 test data, available from the LDC RM1 website.
You also need to prepare a batch file called rm1.batch
,
by following instructions in the Batch Files
section. There is already one in the RM1 test directory, but it will
not work for you, since the paths to test files will not match your setup.
To run the tests:
% cd sphinx4/tests/performance/rm1 % ant -projecthelp # to see a list of possible targets % ant rm1_bigram
You must have the HUB4 test data, available from the LDC HUB4 website.
You must download the binary HUB4 model file, called
HUB4_8gau_13dCep_16k_40mel_133Hz_6855Hz.jar
, and the
binary HUB4 trigram language model, called HUB4_trigram_lm.zip
,
both located at the sphinx4
package in the
downloads page. For the trigram language model file, unpack it by:
jar xvf HUB4_trigram_lm.zipThe trigram model file is called
language_model.arpaformat.DMP
.
Then, in the build file for the HUB4 tests,
sphinx4/tests/performance/hub4/build.xml
,
changed the classpath
property of the build file to
point to the location of your
HUB4_8gau_13dCep_16k_40mel_133Hz_6855Hz.jar
.
In the configuration file,
tests/performance/hub4/hub4.config.xml
, change the 'location'
of the 'trigramModel' component to where your
language_model.arpaformat.DMP
file is located.
You also need to prepare a batch file, which is currently called
f0_hub4.batch
in the build.xml file, by following instructions
in the Batch Files section.
To run the test:
% cd sphinx4/tests/performance/hub4 % ant -projecthelp # to see a list of possible targets % ant hub4_trigram
Each batch mode regression test consists of the following components:
To learn about how to setup a regression test, take a look at the walkthrough of setting up the AN4 tests.
Batch files are used in batch mode regressions tests. It is a text file that contains the list of files to be processed, with the transcription for each file. The format is as shown below: one line for each file, where the first element in a line is the file name, which can be an absolute or relative path, and includes the file extension; after the file name, the words that make up the transcription for the audio. Sphinx-4 uses the transcription provided here to compute the system's accuracy after each sentence is processed. An utterance's processing produces in a hypothesis for what was said. This hypothesis is compared with the transcription, i.e., the hypothesis is aligned against the reference transcript, and a summary of the results is reported.
/lab/speech/sphinx4/data/tidigits/test/raw16k/man/man.ah.24z982za.raw two four zero nine eight two zero /lab/speech/sphinx4/data/tidigits/test/raw16k/man/man.ah.25896o4a.raw two five eight nine six oh four
An example batch file is
tidigits.batch
(this link only works if you downloaded the source distribution).
The audio files used by Sphinx-4 can contain raw audio or cepstra, which is a form of encoded speech. The Java platform has support for other data formats, such as MS WAV or Sun's au, but, provided as is, Sphinx-4 can handle only raw data.
The audio defaults to 2 bytes/sample, at 16000 samples per second. The files are expected to be binaries without header. The Java platform assumes big endian order, always. These defaults can be changed. For example, the byte order or the sampling rate can be changed.
The input can also be cepstra. The cepstral file has a 4 byte integer containing the number of floats that follow. The following floats are 13 dimensional vectors concatenated. Notice that since the first piece of information is the number of floats, the total file size can be computed. If a comparisons with the actual size fails, either the byte order has to be reversed, or the file is corrupted. Importantly, the byte order can be automatically detected.
Walkthrough of Setting up the AN4 Tests
To illustrate the process of setting up a regression test, lets use AN4, an existing test, as an example. Use the following steps to create the AN4 tests.
tests/performance
.
For example, the AN4 tests reside in tests/performance/an4
.
/lab/speech/sphinx4/data/an4
.
Since the AN4 test data
already comes in raw audio format, no conversion is necessary.
However, other test databases might require conversion to raw audio.
For example, the TIDIGITS test files are in SPHERE format, so it is
necessary to convert them to raw audio format before it can be read by
the Sphinx-4 front end. This is usually accomplished by using the
program sox
on UNIX platforms.
tests/performance/an4/an4_full.batch
file looks like:
/lab/speech/sphinx4/data/an4/an4_clstk/fash/an251-fash-b.raw yes /lab/speech/sphinx4/data/an4/an4_clstk/fash/an253-fash-b.raw go /lab/speech/sphinx4/data/an4/an4_clstk/fash/an254-fash-b.raw yes /lab/speech/sphinx4/data/an4/an4_clstk/fash/an255-fash-b.raw u m n y h six ...All batch files should reside in the test directory, in this case
tests/performance/an4
.
ant
at the top level directory will create the JAR file for the WSJ model.
The JAR file should be included in the classpath of the application
you are deploying. In this case, the WSJ JAR file
(lib/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar
) is included
in the java command line inside the build.xml run file. We also need
to specify in the config file (see the next item below)
the acoustic model class we are using, which in this case is
edu.cmu.sphinx.model.acoustic.WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz
. The dictionary is also specified in the config file using
the resource mechanism of Sphinx-4.
tests/performance/an4/an4.config.xml
, please take a look
at it. This file describes how the batch-mode recognizer and
its various sub-components should be configured. Note that this
file also contains configurations for the live-mode recognizer,
which is not the subject of interest of this walkthrough.
In the following we will refer to components in the config file
using highlights
.
In an4.config.xml, the batch-mode recognizer is called batch
.
It uses the Recognizer called wordRecognizer
,
which contains the decoder
, as well as
various monitors that keeps track of recognition accuracy, speed, and
memory. The decoder
contains the searchManager
,
which in turn contains the linguist
, the pruner
,
the scorer
, and the activeList
.
Refer to the Javadoc (go to bottom
of the page) for a description of each of these components.
The linguist used is the flatLinguist
,
and the grammar of the flatLinguist
is either the
wordListGrammar
, which is a file with a list of words, e.g.,
AND APOSTROPHE APRIL AREA AUGUST CODEthe
lmGrammar
(i.e., N-gram language model), or
fstGrammar
(i.e., finite state tranducer grammar).
The lmGrammar
uses a language model file (text-based for AN4)
generated by the CMU
Statistical Language Modeling (SLM) Toolkit.
The flatLinguist
also
specifies the acoustic model used, and in this case it is the WSJ models.
The location and format of the WSJ model, as well as the location of
the various files in the model, are also specified.
The scorer
contains the front end,
which is called mfcFrontEnd
since it produces MFCC features.
build.xml
is necessary to run Ant. This file is the Ant version of the Makefile
in Make. All Ant targets are listed in this file.
For details on how to write this file, refer to the documentation
at http://ant.apache.org/.
Lets use the first Ant target, an4_words_wordlist
, as an
example. This Ant target invokes the java
command
on the class edu.cmu.sphinx.tools.batch.BatchModeRecognizer
.
This class takes a configuration file (an4.config.xml
)
and a batch file (an4_words.batch
) as arguments.
This class looks for the component named batch
in the configuration file. The configuration manager will create this
component (and its subcomponents). Therefore, the component
edu.cmu.sphinx.tools.batch.BatchModeRecognizer
should always
be named "batch"
in the config.xml file.
Other AN4 Ant targets are created similarly.
The two main acoustic models that are used by Sphinx-4, TIDIGITS and
Wall Street Journal, are already included in the "lib"
directory of the binary distribution. For the source distribution, you will
build it when you type ant
at the top level directory.
Our regression tests also uses the RM1 and HUB4 models,
which are available for download separately on the download page.
Sphinx-4 can handle model packages provided as a jar file.
Each acoustic model implements the
AcousticModel interface. For example, the WSJ models are wrapped by
a class called edu.cmu.sphinx.model.acoustic.WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz
, which implements the AcousticModel interface.
This implementation class is in the JAR file of the models, together
with the actual data files of the model. This way, two simple steps are
need to use a particular acoustic model:
You can find out the model implementation class of a JAR file using the
java -jar
command. For example, you can find out the model
class of the WSJ model by:
sphinx4>java -jar lib/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar Wall Street Journal acoustic models Class: edu.cmu.sphinx.model.acoustic.WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz Is Binary: true Sparse Form: false Filters: 40 Vector Length: 39 Gaussians: 8 Model Definition: etc/WSJ_clean_13dCep_16k_40mel_130Hz_6800Hz.4000.mdef Data Location: cd_continuous_8gau Feature Type: cepstra_delta_doubledelta Sample Rate: 16000 Description: Wall Street Journal acoustic models Number Fft Points: 512 Max Freq: 6800 Min Freq.: 130The print out also includes details about how the model was trained, but this is not important for the average user.
The language model used by Sphinx-4 follows the ARPA format. Language models provided with the acoustic model packages were created with the Carnegie Mellon University Statistical Language Modeling toolkit (CMU SLM toolkit), available at CMU. A manual is available there.
The language model is created from a list of transcriptions. Given a file with training transcription, the following script creates a list of words that appear in the transcriptions, then creates a bigram and a trigram LM files in the ARPA format. The file with extension ccs contains the context cues, and it is usually a list of words used as markers - beginning or end of speech etc.
set task = RM # Location of the CMU SLM toolkit set bindir = ~/src/CMU-SLM_Toolkit_v2/bin cat $task.transcript | $bindir/text2wfreq | $bindir/wfreq2vocab > $task.vocab set mode = "-absolute" # Create bigram cat $task.transcript | $bindir/text2idngram -n 2 -vocab $task.vocab | \ $bindir/idngram2lm $mode -context $task.ccs -n 2 -vocab $task.vocab \ -idngram - -arpa $task.bigram.arpa # Create trigram cat $task.transcript | $bindir/text2idngram -n 3 -vocab $task.vocab | \ $bindir/idngram2lm $mode -context $task.ccs -n 3 -vocab $task.vocab \ -idngram - -arpa $task.trigram.arpa
Sphinx-4 uses the Java Speech API Grammar Format (JSGF) to perform speech recognition using a BNF-style grammar. Currently, you can only use JSGF grammars with the FlatLinguist. To specify JSGF grammars, set the following in the configuration file:
<component name="flatLinguist" type="edu.cmu.sphinx.linguist.flat.FlatLinguist"> <property name="grammar" value="jsgfGrammar"> // ... other properties ... </component> <component name="jsgfGrammar" type="edu.cmu.sphinx.jsapi.JSGFGrammar"> <property name="grammarLocation" value="...URL of grammar directory"/> </component>
For information on how to write JSGF grammars, and how to specify the location of your JSGF grammar file(s), and the limitations of the current implementation of JSGF grammar, please refer to the Javadocs for JSGFGrammar.
The Sphinx-4 API can be found in the javadoc documentation.
If the previous is broken, please build the javadocs using the instructions in Creating Javadocs. In fact, rebuilding javadocs is something you should do every time you change code in Sphinx-4.
In this section, we will provide an overview of Sphinx-4, starting with
an introduction of HMM-based recognizers. We will highlight in
Sphinx-4 is an HMM-based speech recognizer.
During speech recognition, features are derived from the
incoming speech (we will use "speech" to mean the same thing as "audio")
in the same way as in the training process. The component of the recognizer
that generates these features is called the
The process of speech recognition is to find the best possible sequence
of words (or units) that will fit the given input speech. It is a
Constructing the above graph requires knowledge from various sources.
It requires a
Usually, the search graph also has information about how likely certain
words will occur. This information is supplied by the
Once this graph is constructed, the sequence of parametrized speech
signals (i.e., the features) is matched against different paths
through the graph to find the best fit.
The best fit is usually the least cost or highest
scoring path, depending on the implementation.
In Sphinx-4, the task of searching through the graph for the best path
is done by the
As you can see from the above graph, a lot of the nodes have self
transitions. This can lead to a very large number of possible paths
through the graph. As a result, finding the best possible path can
take a very long time. The purpose of the
As we described earlier, the input speech signal is transformed into a
sequence of feature vectors. After the last feature vector is decoded,
we look at all the paths that have reached the final exit node
(the red node). The path with the highest score is the best fit, and a
In this section, we describe the main components of Sphinx-4, and how they work together during the recognition process. First of all, lets look at the architecture diagram of Sphinx-4. It contains almost all the concepts (the words in red) that were introduced in the previous section. There are a few additional concepts in the diagram, which we will explain promptly.
When the recognizer starts up, it constructs the front end (which generates features from speech), the decoder, and the linguist (which generates the search graph) according to the configuration specified by the user. These components will in turn construct their own subcomponents. For example, the linguist will construct the acoustic model, the dictionary, and the language model. It will use the knowledge from these three components to construct a search graph that is appropriate for the task. The decoder will construct the search manager, which in turn constructs the scorer, the pruner, and the active list.
Most of these components represents interfaces. The search manager,
linguist, acoustic model, dictionary, language model, active list, scorer,
pruner, and search graph are all Java interfaces. There can
be different implementations of these interfaces. For example,
there are two different implementations of the search manager.
Then, how does the system know which implementation to use? It is specified
by the user via the configuration file, an XML-based file that is loaded
by the
The
When the application asks the recognizer to perform recognition, the search manager will ask the scorer to score each token in the active list against the next feature vector obtained from the front end. This gives a new score for each of the active paths. The pruner will then prune the tokens (i.e., active paths) using certain heuristics. Each surviving paths will then be expanded to the next states, where a new token will be created for each next state. The process repeats itself until no more feature vectors can be obtained from the front end for scoring. This usually means that there is no more input speech data. At that point, we look at all paths that have reached the final exit state, and return the highest scoring path as the result to the application.
The performance of Sphinx-4 critically depends on your task and how you configured Sphinx-4 to suit your task. For example, a large vocabulary task needs a different linguist than a small vocabulary task. Your system has to be configured differently for the two tasks. This section will not tell you the exact configuration for different tasks, which will be dealt with later. Instead, this section will introduce you to the configuration mechanism of Sphinx-4, which is via an XML-based configuration file. Please click on the document Sphinx-4 Configuration Management to learn how to do this. It is important that you read this document before you proceed.


 Clicking on a link sends http request
to a server and retrieves HTML file and sends it to your web browser to display the page
HTML stands for hyper text markup language and is what forms the majority of content on the web
HTML is made using elements, tags are what tell the browser which element to use.Make sure to close tags that require closing, the computer only know what you tell it to do, a misplace tag can create alot of problems
Inline elements dont disrupt the flow of text like an a tag. block elements create and invisble box around the content inside of them


NASA Buzzword Generator
A NASA engineer created a buzzword generator in 1966 that uses a random 3-digit number to create a meaningless but fancy-sounding name to impress politicians and other non-science professionals`. See it here
Press
to
generate


hagis Complexities — autoplot.hagis.complexities" />
Creates a ggplot2 object of the frequency of complexity
(percent per complexity) calculated by calculate_complexities()
or a
ggplot2 object of the distribution (number per complexity).
# S3 method for hagis.complexities autoplot(object, type, color = NULL, ...)
| object | a hagis |
|---|---|
| type | a vector of values for which the bar plot is desired. Specify
whether to return a graph of the frequency of complexities as a percentage,
|
| color | a named or hexadecimal color value to use for the bar color |
| ... | passed to the chosen |
A ggplot2 plot
Ps <- system.file("extdata", "practice_data_set.csv", package = "hagis") # import 'practice_data_set.csv' Ps <- read.csv(Ps) # calculate susceptibilities with a 60 % cutoff value complexities <- calculate_complexities(x = Ps, cutoff = 60, control = "susceptible", sample = "Isolate", Rps = "Rps", perc_susc = "perc.susc") # Visualize the distribution (count or actual values) autoplot(object = complexities, type = "count")


MobX for the Dart language.
Supercharge the state-management in your Dart apps with Transparent Functional Reactive Programming (TFRP)
MobX is a state-management library that makes it simple to connect the reactive data of your application with the UI. This wiring is completely automatic and feels very natural. As the application-developer, you focus purely on what reactive-data needs to be consumed in the UI (and elsewhere) without worrying about keeping the two in sync.
It's not really magic but it does have some smarts around what is being consumed (observables) and where (reactions), and automatically tracks it for you. When the observables change, all reactions are re-run. What's interesting is that these reactions can be anything from a simple console log, a network call to re-rendering the UI.
MobX has been a very effective library for the JavaScript apps and this port to the Dart language aims to bring the same levels of productivity.


Renault Kwid, Duster, Lodgy now get 7-year extended warranty
by Jaiveer MehraRenault’s Anytime Warranty Plan lets owners extend their existing warranty by 1 year/20,000 starting from the third year until the seventh year of ownership, but subject to a cap of 1 lakh km.
Renault is offering its cars and SUVs with an extended warranty of up to 7 years/1 lakh km under the its Anytime Warranty Plan. The plan allows owners to extend their existing warranties by 1-year/20,000 starting from the third year, until the seventh year of ownership (subject to a cap of 1 lakh km).
Renault offers a 2-year /50,000km warranty as standard across nearly all its models – the exception is the Kwid, which gets a 4-year/1 lakh km warranty standard. This can be extended up to 5-year/1 lakh km under Renault’s standard extended warranty schemes. Under the Anytime Warranty Plan, owners can extended their standard warranty or extended warranty, to cover the car up until the seventh year of ownership or up to 1 lakh km. Customers can also avail of warranty coverage under the scheme even if their warranty package has expired and/or if the car has not been serviced at authorised service centres.
The warranty plan offers coverage for major components such as engine, gearbox, ECM, starter motor, alternator, differential, AC compressor and the steering box. Also offered with the package is roadside assistance service.
Prices for the Anytime Warranty Plans range from Rs 5,775 for the third year for a Renault Kwid 0.8 and go as high as Rs 21,550 for coverage for the seventh year for the Renault Lodgy, if the car has been maintained at an authorised service centre. For cars serviced at third-party garages, prices range from Rs 8,390 to Rs 34,175, for same.
The same plans are also on offer on now discontinued Renault models such as the Pulse hatchback, Scala sedan, Fluence executive sedan and the Koleos SUV, with prices ranging from Rs 7,820 to Rs 94,810 depending on model, year of coverage and service history.
Also see:
Maruti S-Presso vs Renault Kwid comparison
Renault Triber RxZ now gets 15-inch wheels as standard
2019 Renault Kwid: Which variant to buy?


| init_oauth2.0 {httr} | R Documentation |
See demos for use.
init_oauth2.0( endpoint, app, scope = NULL, user_params = NULL, type = NULL, use_oob = getOption("httr_oob_default"), oob_value = NULL, is_interactive = interactive(), use_basic_auth = FALSE, config_init = list(), client_credentials = FALSE, query_authorize_extra = list() ) oauth2.0_authorize_url( endpoint, app, scope, redirect_uri = app$redirect_uri, state = nonce(), query_extra = list() ) oauth2.0_access_token( endpoint, app, code, user_params = NULL, type = NULL, use_basic_auth = FALSE, redirect_uri = app$redirect_uri, client_credentials = FALSE, config = list() )
endpoint |
An OAuth endpoint, created by |
app |
An OAuth consumer application, created by
|
scope |
a character vector of scopes to request. |
user_params |
Named list holding endpoint specific parameters to pass to the server when posting the request for obtaining or refreshing the access token. |
type |
content type used to override incorrect server response |
use_oob |
if FALSE, use a local webserver for the OAuth dance.
Otherwise, provide a URL to the user and prompt for a validation
code. Defaults to the of the |
oob_value |
if provided, specifies the value to use for the redirect_uri
parameter when retrieving an authorization URL. Defaults to "urn:ietf:wg:oauth:2.0:oob".
Requires |
is_interactive |
DEPRECATED |
use_basic_auth |
if |
config_init |
Additional configuration settings sent to
|
client_credentials |
Default to |
query_authorize_extra |
Default to |
query_extra |
See |


Web development broadly refers to the tasks associated with developing websites for hosting via intranet or internet.The web development process includes web design,client-side/server-side scripting and network security configuration,among other tasks.
My Design process always starts with a pencil and paper, scribbling ideas and concepts, thinking about the problem and the solution. Once I have an idea of what I want to achieve, I’ll then sit down at my computer and start with wire frames and low level mockups. Then add the imagery, typography design and details.
HTML stands for HyperText Markup Language. Developed by scientist Tim Berners-Lee in 1990, HTML is the "hidden" code that helps us communicate with others on the World Wide Web (WWW). When writing HTML, you add "tags" to the text in order to create the structure.
Jquery stands for HyperText Markup Language. Developed by scientist Tim Berners-Lee in 1990, HTML is the "hidden" code that helps us communicate with others on the World Wide Web (WWW). When writing HTML, you add "tags" to the text in order to create the structure.
Hypertext Preprocessor is a general-purpose programming language originally designed for web development. It was originally created by Rasmus Lerdorf in 1994; the PHP reference implementation is now produced by The PHP Group.PHP originally stood for Personal Home Page,but it now stands for the recursive initialism PHP: Hypertext Preprocessor.
I need a team on webdevelopment.Web teams are made up of a diverse group of people who all contribute their skills in multiple avenues. Each person has a different role that combines with the others to work toward a common goal. ... Before any products or digital services can be offered, the web team must make edits and check for quality.
Teamwork is the collaborative effort of a group to achieve a common goal or to complete a task in the most effective and efficient way. This concept is seen within the greater framework of a team, which is a group of interdependent individuals who work together towards a common goal


The function declaration defines a function with the specified parameters.
You can also define functions using the Function constructor and a function expression.
function name([param,[, param,[..., param]]]) { [statements] }
name
param
statements
A function created with a function declaration is a Function
object and has all the properties, methods and behavior of Function
objects. See Function for detailed information on functions.
A function can also be created using an expression (see function expression).
By default, functions return undefined
. To return any other value, the function must have a return statement that specifies the value to return.
Functions can be conditionally declared, that is, a function statement can be nested within an if
statement. Most browsers other than Mozilla will treat such conditional declarations as an unconditional declaration and create the function whether the condition is true or not, see this article for an overview. Therefore they should not be used, for conditional creation use function expressions.
Function declarations in JavaScript are hoisting the function definition. You can use the function before you declared it:
hoisted(); // logs "foo" function hoisted() { console.log("foo"); }
Note that function expressions are not hoisted:
notHoisted(); // TypeError: notHoisted is not a function var notHoisted = function() { console.log("bar"); };
function
The following code declares a function that returns the total amount of sales, when given the number of units sold of products a
, b
, and c
.
function calc_sales(units_a, units_b, units_c) { return units_a*79 + units_b * 129 + units_c * 699; }
Created by Mozilla Contributors, license: CC-BY-SA 2.5


Gold leaf water Inc. was founded in 2015, with a sole purpose of sharing the best resource to families in our native country.
Join our family sharing the best resource with your family.


THtmlViewer component
Use methods LoadFromDocument or LoadFromString instead.
procedure LoadFromBuffer(Buffer: PChar; BufSize: LongInt; const Reference: ThtString = '');
The LoadFromBuffer method loads an HTML document from a memory buffer. BufSize is the number of characters to be loaded. A terminating null character is not required.
Reference is an optional reference parameter.
Assume an HTML document exists in a TMemo object. The following code could be used to then copy the document to an THtmlViewer object:
var Buffer: PChar; Size: integer; begin Size := Memo1.GetTextLen; Inc(Size); GetMem(Buffer, Size); Memo1.GetTextBuf(Buffer,Size); Viewer.LoadFromBuffer(Buffer, Size-1); FreeMem(Buffer, Size); end;


Your Quick Launch is empty!
Drag a browser to the quick launch bar on the browser listing to add browsers to your Quick Launch.


{% extends "base.html" %} {% block title %}Page 3{% endblock %} {% block content %}
This is the third page. It only exists to demonstrate that the character we use for subhashes, ":", can aso exist in normal hrefs.


I started my tech journey in 2019 after taking a cloud course for AWS. Since then my interest in programming has led me to different training and experiences to accomplish the projects displayed in this web portfolio.
I love electronic devices, video games, tech innovations, building software, and coding as long as it's fun and makes the world a better place. For more information on my work history please see my resume below, and for more information about me please visit my linkedin profile.
This is a full stack application that detects faces in pictures! The site allows a user to register creating their own login credentials, count how many times they've searched for face detection, and sign in and out as many times as they want while securely storing their information. I built this app using HTML5, CSS3, ReactJS, NodeJS, and MongoDB.
This is a front-end web application that utilizes an API to display random quotes by the click of a button! The quote box displays the quote, the author, and you can even post your favorite quotes to twitter! I built this site using HTML5, CSS3, and Javascript.
This is a front-end web application that utilizes an API to display random users along with their photos... as robots! A search input allows you to search the list according to their name, and updates accordingly. I built this app using HTML5, CSS3, and ReactJS. This version shows React being used with Redux successfully.
This is a front-end web application and audio music player that utilizes an API to play songs and change tracks! The audio has 3 tracks total which are Electric Chill Machine, Seven Nation Army, and Goodnight Disco Queen all by Jacinto Design. I built this site using HTML5, CSS3, and Javascript.
This is a front-end web application that utilizes an API to display random users along with their photos... as robots! A search input allows you to search the list according to their name, and updates accordingly. I built this app using HTML5, CSS3, and ReactJS. This version shows my understanding and use of React hooks.
This is a front-end web application that utilizes Unsplash API to display photos in endless fashion! When the scroller reaches near the bottom of the page another API call is made to continue the display of pictures. I built this site using HTML5, CSS3, and Javascript.
This is a front-end web application that utilizes an API to display random users along with their photos... as robots! A search input allows you to search the list according to their name, and updates accordingly. I built this app using HTML5, CSS3, and ReactJS.
This is a front-end website that diplays a window or picture inside of the browser window. Choose which style once prompted, and a smaller window will display within the page! This site was built using HTML5, CSS3, and Javascript.
This is a front-end website that diplays day and night mode when toggle is switched! This website was built using HTML5, and CSS3. Toggle the switch to the upper left of the page to see all features adjust! It also stores which light setting you leave the site on upon refreshing the page!
This is a front-end website that utilizes an API for joke telling audio to tell jokes all while using a cute animation background of one of my robot friends. Enjoy! This was built using HTML5, CSS3, and Javascript.
Let's Keep in Touch!
Contact Me


British backpacker strangled by man she met on Tinder, court in New Zealand told
A British backpacker was strangled by a man she met on Tinder, who left her body in a suitcase while he went on another date, a court has heard.
The body of 22-year-old Grace Millane was found in a forested area near Auckland, New Zealand, a week after she was last seen at a hotel in the city centre on December 2.
Ms Millane, from Wickford in Essex, was on a round-the-world trip when she arrived in New Zealand last November.
A 27-year-old man, whose name cannot be published for legal reasons, is standing trial accused of her murder at the city’s High Court.
Opening the case, Crown prosecutor Robin McCoubrey said Ms Millane and the defendant met via the dating app Tinder, and they went to a number of bars in Auckland city centre.
He said: “They were plainly comfortable in one another’s company that evening,” referring to security footage that showed them together.
“From the footage, you’ll see them kissing. Both parties probably anticipated sexual activity,” he added.
Mr McCoubrey said the defendant lied to police about what occurred when he was first interviewed, telling them he had simply met Ms Millane “for a drink and then parted company”.
But he later told them that they had engaged in rough sexual intercourse involving biting and hitting, Mr McCoubrey said.
Afterwards, the defendant allegedly told police he fell asleep in the shower, then woke up and went back to bed.
“‘I woke up the next day and saw that she was lying on the floor. I saw that she had blood coming from her nose’,” Mr McCoubrey quoted the defendant as saying.
Mr McCoubrey said Ms Millane was found to have “other bruises that were consistent with restraint” on her “upper chest area and upper inner arms”.
“It is the crown’s case that Ms Millane was strangled by (the defendant),” he added.
The prosecutor said that in the hours after Ms Millane died, the defendant engaged in a number of internet searches, including for the Waitakere Ranges, where her body was found.
He also used Google to search for “the hottest fire”, he said.
READ MORE
Corbyn to pledge he will end need for food banks if he becomes British PM
“It’s plain that Ms Millane is dead at that point,” Mr McCoubrey said.
“What (the defendant) is trying to do is find a place to dispose of her body.”
“He wasn’t distressed or concerned by her death,” Mr McCoubrey said, adding that the defendant then began searching pornographic websites.
The Crown alleged that the defendant broke off his internet search to take seven intimate photos of Ms Millane’s body.
The defendant then resumed searching pornographic websites, before searching for “large bags near me” and “rigor mortis”.
Security footage showed the defendant later purchased a suitcase from a business on Elliott Street in the city centre.
“He contorted Ms Millane’s body into that suitcase,” Mr McCoubrey said.
The prosecutor added that the defendant “doesn’t seem concerned by the dead body in his apartment” as he travelled to nearby Ponsonby Road and went “on another date” later on December 2.
Ms Millane’s parents David and Gillian were present in court for the start of the trial, which is due to last five weeks.
READ MORE
Three women and six children, all US citizens, killed in Mexico cartel massacre


For the first time in years EJB has a new bean type, the @Singleton. In my opinion, the javax.ejb.Singleton will replace a lot of what people are using @Stateless for today.
The Singleton is essentially what you get if you take a Stateless bean and
adjust the pool size to be exactly 1 resulting in there being exactly one
instance of the Singleton bean in the application which can be invoked
concurrently by multiple threads, like a servlet. It can do everything a
Stateless can do such as support local and remote business interfaces, web
services, security, transactions, and more. Additionally, the Singleton
can have its @PostConstruct method called with the application starts up
and its @PreDestroy method called when the application shuts down. This
allows it to serve as an application lifecycle listener which is something
only Servlets could do before. It has an @Startup annotation which is
similar in concept to the servlet
See the Singleton Example for sample bean code and client.
Singletons support two modes of concurrent access, Container-Managed Concurrency (the default) and Bean-Managed Concurrency.
With Bean-Managed Concurrency, annotated as @ConcurrencyManagement(BEAN), the container sends all invocations into the bean and lets the Singleton bean instance decide how and when to synchronize access, if at all. Here the 'synchronization' keyword is allowed as well as the full javax.util.concurrent set of libraries.
With Container-Managed Concurrency, annotated as @ConcurrencyManagement(CONTAINER), the container will enforce concurrency for you via locking method access to the bean. Two modes, called locks exist and can be assigned to both the bean class and methods of the bean class.
The first and the default is a "write" lock, annotated as @Lock(WRITE). Essentially, with a write lock the caller holds an exclusive lock on the bean for the duration of the method call and all other threads for that or any other method must wait.
The second option is a "read" lock, annotated as @Lock(READ). The read lock allows full concurrent access to the methods (assuming no write locks are held). The default mode of "write" essentially makes your bean a single-threaded bean, which is very slow. The more conservative @Lock(WRITE) was chosen as the default as this is how all the other bean types work (only a single thread may access a bean instance at any given time). Those that are aware of how to handle concurrent access can easily put @Lock(READ) on their bean class, thus changing the default, and then @Lock(WRITE) on specific methods if needed.
The locking modes of Container-Managed Concurrency map directly to the *java.util.concurrent.ReadWriteLock * API which looks like this:
public interface ReadWriteLock {
/**
* Returns the lock used for reading.
*
* @return the lock used for reading.
*/
Lock readLock();
/**
* Returns the lock used for writing.
*
* @return the lock used for writing.
*/
Lock writeLock();
}
Literally 100% of the Singleton locking we're talking about is taken from this interface and its javadoc is a great source of information. It's safe to imagine that under the covers the Singleton Container has an instance of ReadWriteLock which it uses to enforce the locking for all the Singleton bean's methods. Essentially:
The EJB container may use something other than ReadWriteLock but the semantics of a ReadWriteLock must be followed. Internally, we use an instance of java.util.concurrent.ReentrantReadWriteLock which supports correct memory synchronization, some reentrancy, lock downgrading, and [more|http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/locks/ReentrantReadWriteLock.html] .
The @AccessTimetout annotation can configure how long a thread will wait to acquire the read or write lock. This annotation can be used on the bean class or individual methods. The annotation maps directly to the java.util.concurrent.locks.Lock interface.
public interface Lock {
/**
* Blocks (potentially) forever
*
* @AccessTimout with a value of -1
*/
void lock();
/**
* Non-blocking
*
* @AccessTimout with a value of 0
*/
boolean tryLock();
/**
* Blocks (potentially) up to a limit
*
* @AccessTimout(30, TimeUnit.SECONDS)
*/
boolean tryLock(long time, TimeUnit unit) throws InterruptedException;
}
In the event it is not possible to acquire the lock a javax.ejb.ConcurrentAccessException or javax.ejb.ConcurrentAccessTimeoutException will be thrown.
The default value of @AccessTimeout annotation is vendor specific. In OpenEJB it defaults to the value of the AccessTimeout property which can be configured in many different scopes. Here is the order of preference:
The value of the property can be phrased in plain english such as "1 hour and 23 minutes and 17 seconds" see Configuring Durations for details.
Singletons have an @Startup annotation which can be applied to the bean class. When used, the Container will instantiate the Singleton instance eagerly when the application starts up, otherwise the Container will instantiate the Singleton instance lazily when the bean is first accessed.
If one Singleton refers to another Singleton in the @PostConstruct or @PreDestroy method, there must be some measure taken to ensure the other Singleton exists and is started. This sort of ordering is achieved with the @DependsOn annotation which can be used to list the names of Singleton beans that must be started before the Singleton bean using the annotation.
@DependsOn({"SingletonB", "SingletonC"})
@Singleton
public class SingletonA {
}
Circular references are not supported. If BeanA uses @DependsOn to point to BeanB and BeanB also uses @DependsOn to point at BeanA, the result is a deployment exception. Be aware that circular references can happen in less trivial ways such as A referring to B which refers to C which refers to D which refers back to A. We will detect and print all circular dependencies (called circuits) at deploy time.
Note that @DependsOn is only required (and should only be used) if a Singleton uses another Singleton in its @PostConstruct method or @PreDestroy method. Simply having a reference to another Singleton and using it in other business methods does not require an @DependsOn declaration. The @DependsOn allows the Container to calculate the correct startup order and shutdown order so that it can guarantee the Singletons you need are available in your @PostConstruct or @PreDestroy methods. All Singletons will automatically be available to your business methods regardless if @DependsOn is used. Because of the greater chance of creating circular dependencies, it is better not to use the @DependsOn annotation "just in case" and should only be used when truly needed.
Singletons can be declared in the ejb-jar.xml as follows:
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>MySingletonBean</ejb-name>
<ejb-class>org.superbiz.MySingletonBean</ejb-class>
<session-type>Singleton</session-type>
<load-on-startup/>
<depends-on>
<ejb-name>SingletonFoo</ejb-name>
<ejb-name>SingletonBar</ejb-name>
</depends-on>
</session>
</enterprise-beans>
</ejb-jar>


Introduction
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Continuation
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
External
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Extra Externalu
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.


WITNESS LIST Appropriations-S/C on General Government Committee February 8, 2005-7:00A Budget Against: Cline, Michael (Self) Johnson, Helen (State Firemen's and Fire Marshals' Association) Stewart, James (Self and Texas Library Association) Todaro, Julie (Self and Texas Library Association) On: Barnhill, Jane (Texas Historical Commission) Beck, Jim (Office of the Secretary of State) Bow, Jonathan D. (State Office of Risk Management) Brieden III, John A. (Texas Veterans Commission) Cargile, Stuart B. (State Office of Risk Management) Colley, Terry (Texas Historical Commission) Deiters, Kevin (Fire Fighter Pension Commissioner) Edwards, Kim (Texas Public Finance Authority) Fernandez, Linda (Department of Information Resources) Garcia, Buddy (Secretary of State) Ivie Miller, Lisa (Self and Fire Fighter's Pension Commissioner) Kelly, David (Texas Public Finance Authority) McGeehan, Ann (Office of the Secretary of State) Nier, James E. (Texas Veterans Commission) Oaks, Larry (Texas Historical Commission) Olson, Larry (Department of Information Resources) Pickett, Sandra (Texas State Library and Archives) Polan, Gaye (State Preservation Board) Reisman, David A. (Texas Ethics Commission) Rider, Martha (State Office of Risk Management) Rudd, Peggy D. (Texas State Library and Archives Commission) Schiermeyer, Ruth (Texas Public Finance Authority) Scopel, Allen J. (Texas Statewide Emergency Personnel Services Pension Fund) Shivers, Shari (Pension Review Board) Smith, Virginia "Ginger" P. (Texas Pension Review Board) White, Rebeca (Office of the Governor and Governor's Trusteed Programs) Woelk, Sarah (Texas Ethics Commission)


class: center, middle, inverse, title-slide # Lecture 04 ## Standards ### Ivan Rudik ### AEM 4510 --- exclude: true ```r if (!require("pacman")) install.packages("pacman") pacman::p_load( tidyverse, xaringanExtra, rlang, patchwork, nycflights13, tweetrmd, vembedr ) options(htmltools.dir.version = FALSE) knitr::opts_hooks$set(fig.callout = function(options) { if (options$fig.callout) { options$echo <- FALSE } knitr::opts_chunk$set(echo = TRUE, fig.align="center") options }) ``` ``` ## Warning: 'xaringanExtra::style_panelset' is deprecated. ## Use 'style_panelset_tabs' instead. ## See help("Deprecated") ``` ``` ## Warning in style_panelset_tabs(...): The arguments to `syle_panelset()` changed in xaringanExtra 0.1.0. Please refer to the documentation to update your slides. ``` --- # Roadmap 1. How do we model our problems going forward? 2. What are the different kinds of standards in theory and the real world? 3. What happens under a standard? --- class: inverse, center, middle name: what_is_enviro # Pigouvian policy

 --- # Pigouvian policy Much of what we will be looking at going forward are .hi[Pigouvian] policies -- A Pigouvian policy aims to force polluters to realize the costs of their emissions (or forces the creator of a public good to realize the external benefit) in the absence of a market to do the same -- Next we will look at command and control and emission standard regulations --- # Pigouvian policy: Arthur Pigou .pull-left[  ] .pull-right[ Pigou is responsible for the famous distinction between private and social marginal products and costs and the idea that governments can, via a mixture of taxes and subsidies, correct such market failures: "internalize the externalities” ] --- # Working example: pollution from coal .pull-left[  ] .pull-right[ When we're discussing these policies you can think about them as regulating emissions from coal-fired power plants Coal power is one of the largest sources of several of the most harmful air pollutants ] --- # Coal power: air pollutants
--- # Coal power: air pollutants .hi[Sulfur dioxide:] Coal plants are the leading source of `\(SO_2\)` pollution -- - Forms small acidic particulates that can penetrate into human lungs and be absorbed by the bloodstream - Causes acid rain which damages crops, forests, soils Typical plant can emit > 14,000 tons per year Typical plant with control equipment (e.g. scrubbers) emits 7,000 tons --- # Coal power: air pollutants .hi[Nitrogen oxides:] `\(NO_x\)` causes ground-level ozone which harms respiratory systems, damages crops -- Typical plant can emit > 10,000 tons per year Typical plant with control equipment (e.g. catalytic tech) emits > 3,000 tons --- # Coal power: air pollutants .hi[Particulate matter:] PM is a catch all for small stuff, causes respiratory, cardiovascular issues, death, haze, negative effects on cognition, etc, etc -- PM is one of the most costly pollutants on the planet Typical plant can emit > 500 tons per year Typical plant with control equipment (e.g. baghouses) emits just a few tons a year --- # Costs of particulate matter  --- # Costs of particulate matter  --- # Costs of particulate matter  --- # Coal power: air pollutants .hi[Mercury:] Coal plants are responsible for more than half of the U.S. human-caused emissions of mercury -- Mercury causes brain and heart damage Just 1/70th of a teaspoon of mercury deposited on a 25-acre lake can make the fish unsafe to eat Typical plant can emit `\(>\)` 170 pounds per year Activated carbon injection technology can reduce mercury emissions by up to 90 percent when combined with baghouses, but is only on 8% of the coal fleet --- # Coal power: air pollutants
--- # Coal and health in 1800s Britain .pull-left[  ] .pull-right[ Coal production in Britain was STRONGLY associated with mortality Coal is super bad for your health Beach and Hanlon (2018) ] --- # Coal going forward
--- # Coal production Coal power requires a lot of inputs: capital, labor, materials, fuel, air -- Clean air is the one input they don't have to buy -- Coal plants avoid 'using' clean air by: - fuel switching - installing scrubbers -- Repeated reductions in emissions require larger and larger increases in capital to hold electricity production fixed (i.e., movement along a convex isoquant) --- # Setting up our model .pull-left[ ![marginal abatement cost](04-slides-standards_files/figure-html/mac-1.png) ] .pull-right[ We will be working with graphs where we have cost as a function of emissions First we have the .hi[marginal abatement cost (MAC)] curve This tells us the cost of abating the next unit of emissions ] --- # Setting up our model .pull-left[ ![marginal abatement cost](04-slides-standards_files/figure-html/mac-1.png) ] .pull-right[ The MAC curve is .hi-red[decreasing] in emissions This means its .hi[increasing] in abatement: its costlier to reduce emissions as the level of emissions goes down ] --- # Setting up our model .pull-left[ ![marginal abatement cost](04-slides-standards_files/figure-html/mac2-1.png) ] .pull-right[ Abatement increases as you move to the left on the graph This raises marginal abatement cost ] --- # Setting up our model .pull-left[ ![marginal abatement cost is marginal emissions benefit](04-slides-standards_files/figure-html/mac3-1.png) ] .pull-right[ Abatement decreases (emissions increase) as you move to the right on the graph This decreases marginal abatement cost You can think of this as alternatively the .hi[marginal emissions benefit (MEB)] from reduced abatement costs ] --- # Setting up our model .pull-left[ ![marginal abatement cost](04-slides-standards_files/figure-html/mac3-1.png) ] .pull-right[ We can equivalently plot the MAC a different way Now plot the MAC as a function of abatement What will the MAC look like? ] --- # Setting up our model .pull-left[ ![marginal abatement cost](04-slides-standards_files/figure-html/mac4-1.png) ] .pull-right[ Abatement decreases (emissions increase) as you move to the right on the graph This decreases marginal abatement cost You should eventually be comfortable with either representation of MACs ] --- # Setting up our model .pull-left[ ![marginal damage](04-slides-standards_files/figure-html/mac-md-1.png) ] .pull-right[ Next we have the .hi[marginal damage (MD)] curve This gives us the external cost of the next unit of emissions It is also the social cost since we assume the private cost of emitting is zero ] --- # Setting up our model .pull-left[ ![marginal damage](04-slides-standards_files/figure-html/mac-md-1.png) ] .pull-right[ How do we think about this? One of two ways 1. MAC is the social marginal benefit of emissions, MD is the social marginal cost of emissions 2. MAC is the social marginal cost of abatement, MD is the social marginal benefit of abatement These are identical interpretations ] --- # The unregulated/free market .pull-left[ ![marginal damage](04-slides-standards_files/figure-html/mac-md-1.png) ] .pull-right[ What is the unregulated / free market outcome? ] --- # The unregulated/free market .pull-left[ ![marginal damage](04-slides-standards_files/figure-html/mac-md-1.png) ] .pull-right[ What is the unregulated / free market outcome? Think about the firm's problem in terms of the marginal benefits and costs of emissions ] --- # The unregulated/free market .pull-left[ ![marginal damage](04-slides-standards_files/figure-html/mac-md-1.png) ] .pull-right[ The PMB of emissions is given by the MAC (avoided abatement cost, an opportunity cost) The PMC of emissions without regulation is....zero So firms set emissions where: PMB=PMC `\(\rightarrow\)` MAC = 0 Free market outcome is `\(E=E_0\)` ] --- # The unregulated/free market .pull-left[ ![marginal damage](04-slides-standards_files/figure-html/mac-md-1.png) ] .pull-right[ But, if we could get all the victims of pollution together, they are willing to pay up to `\(MD\)` in order to get the firm to abate the pollution The MAC for eliminating the first unit of emissions is `\(\approx 0\)` ] --- # The cost of no regulation .pull-left[ ![marginal damage](04-slides-standards_files/figure-html/no-reg-dwl-1.png) ] .pull-right[ People are willing to pay to eliminate emissions until `\(E=E^*\)` If we add up all of these potential surpluses from Pareto improving trades, we get our DWL from the externality ] --- class: inverse, center, middle name: what_is_enviro # Command and control

 --- # Command and control How do we recover that surplus? -- One way is to use .hi[command and control] policy (aka a technology standard) -- Command and control requires firms all employ some particular abatement or emissions control technology (i.e., “scrubbers”—devices that pull out bad emissions before they enter smokestack) -- Common in the early days of implementing the Clean Air Act of 1970 -- Called “command and control” because a government agency (e.g. the EPA) imposes (e.g. commands) a common control technology standard on all firms --- # Command and control >> Thirty Years ago, the economists at Resources for the Future were pushing the idea of pollution taxes. We lawyers at the NRDC (Natural Resources Defense Council) thought they were nuts, and feared that they would derail command-and-control measures like the Clean Air Act, so we opposed them. Looking back, I’d have to say this was the single biggest failure in environmental management – not getting the prices right…” > Gus Speth, 2002. Dean, Yale School of Forestry and Environmental Studies. Former head of World Resources Institute and co-founder of NRDC --- # Brief aside If you're interested in doing cool real world policy work on the environment, RFF hires paid interns every summer and RAs on a 1-2 year basis, RA positions there are basically a stepping stone into top graduate programs Half of the environmental economists at Dyson have current/prior affiliations with RFF  --- # Command and control What are some CC policy examples? -- 1. Coal plants were required to install scrubbers with 90% efficiency ratings until 1990 -- 2. In the 1970s the US mandated catalytic converters in cars -- 3. The Clean Air Act mandates that the 'Best Available Control Technology' be used by emission sources (often not clearly defined) --- # Command and control .pull-left[  ] .pull-right[ CC policies are nice because they have low administrative costs (do you have this technology installed or not?) They also have significant costs in that they lead to distortions ] --- # Command and control .pull-left[  ] .pull-right[ Coal from WY has much lower sulfur content than coal from WV Ideally, if we want to reduce sulfur dioxide emissions, we would like coal plants to use more low-sulfur WY coal ] --- # Command and control  Senator Byrd from WV single-handledly blocked legislation for sulfur regulations and pushed for scrubber mandates so that high-sulfur WV coal could compete with low-sulfur WY coal --- # Command and control What other drawbacks are there to CC policies? -- CC policies can discourage firms from investing in newer and better abatement technologies If they are in compliance with the policy, why do any better? -- The government is picking winners and losers in technology -- Current firms can “capture” regulatory board and require technologies that are easy to implement, or may serve as a barrier-to-entry to new competition --- class: inverse, center, middle name: what_is_enviro # Emission standards

 --- # Emission standards An emission standard `\(\bar{E}\)` mandates a maximum amount of emissions `\(E \leq \bar{E}\)` -- You can think about it as a bubble over multiple plants/emission sources owned by each firm, the firm can decide how to allocate emissions across plants -- Importantly: does .hi[not] mandate a specific technology > On March 16, 2011 EPA proposes Mercury and Air Toxic Standards, the first nationwide limits on coal-fired power plant emissions of mercury. Specifically, the proposal aims to reduce emissions from new and existing coal and oil-fired EGUs by 91% from current levels through national quantity-based, numerical emission limits on mercury releases. --- # Emission standards What is the socially optimal standard? -- The `\(\bar{E}\)` that minimizes total social cost: abatement cost + damages -- Let `\(C(E)\)` be abatement cost of emissions level `\(E\)` and `\(D(E)\)` be damages at `\(E\)` -- We assume that: `\(C'(E) < 0 \leftrightarrow \underbrace{-C'(E)}_{\text{MAC}} > 0\)` and `\(\underbrace{D'(E)}_{\text{MD}} > 0\)` --- # Emission standards `\(-C'(E)\)` is the MAC because we are decreasing emissions by 1, `\({dE \over dA} = -1\)`: `$$\underbrace{\frac{d C(E)}{dA}}_{\text{MAC}} = \frac{d C(E)}{dE}{dE \over dA} = -\frac{d C(E)}{dE} = -C'(E)$$` -- We know abatement costs are decreasing in emissions and damages are increasing in emissions -- Next: how do the firm and regulator make decisions? --- # Emission standards: firm The firm problem: minimize the cost of satisfying the policy: $$ \min_E C(E) \,\,\, \text{subject to: } \,\,\, E \leq \bar{E}$$ -- If `\(C(E)\)` is decreasing in `\(E\)`, but `\(E\)` is restricted to be below `\(\bar{E}\)`.... -- The firm optimally selects `\(E = \bar{E}\)` -- Next we have the regulator's problem --- # Emission standards: regulator The regulator's problem is to minimize the social cost of emissions `$$\min_{\bar{E}} \left\{C(E) + D(E)\right\} \,\,\, \text{subject to: } \,\,\, \underbrace{E = \bar{E}}_{\text{firm's choice}}$$` -- The optimal choice of `\(\bar{E}\)` is governed by the first-order condition: `$$-C'(\bar{E}) = D'(\bar{E})$$` The regulator chooses `\(\bar{E}\)` to be the emission level where MAC = MD: `\(\bar{E} = E^*\)` --- # Emission standards: graphical .pull-left[ ![standards](04-slides-standards_files/figure-html/standard-1.png) ] .pull-right[ The optimal standard restricts emissions to be `\(\bar{E} = E^*\)` You can think of this as the regulator setting a tax equal to 0 on the first `\(\bar{E}\)` units of emissions, and a tax of `\(\infty\)` on each unit after ] --- # Emission standards: graphical .pull-left[ ![standards](04-slides-standards_files/figure-html/standard-1.png) ] .pull-right[ Firms will then only emit `\(\bar{E}\)` since emitting any more has infinite cost, emitting any less incurs extra abatement cost Firms total abatement cost under the standard is equal to the red area (B) ] --- # Emission standards: graphical .pull-left[ ![standards](04-slides-standards_files/figure-html/standard-1.png) ] .pull-right[ The previous example assumed firms couldn't lie/cheat and **not** abate at all Suppose that they can, but they are inspected with probability `\(p\)` If they are caught cheating, they pay a fine `\(F\)` What determines whether the firm cheats? ] --- # Emission standards: graphical .pull-left[ ![standards](04-slides-standards_files/figure-html/standard-1.png) ] .pull-right[ Firm cheats if the benefits are greater than the expected costs Benefits: `\(B\)` Expected costs: `\(pF\)` Cheat if `\(B \geq pF\)` This tells us how big of a fine or how often inspections need to be to stop cheating ] --- # Tailpipe emission standards With the passage of the Clean Air Act (CAA) in 1970, the EPA began regulating nitrogen oxide (NOx) emissions from light duty vehicles -- CAA was amended in 1990, and new emission standards (in grams/mile) were set for four additional smog pollutants - Non-methane organic gases (NMOG) - Carbon monoxide (CO) - Particulate matter (PM) - Formaldehyde (HCHO) --- # Tailpipe emission standards The amendments also gave California authority to pass its own stricter vehicle emission standards, due to its particularly worse air pollution issues -- EPA must approve CA’s stricter standards States may choose to follow either the federal or California standards -- Smog pollution standards were initially different for cars and light duty trucks -- In 2000, the Tier 2 program established one set of standards for both -- Currently, Tier 3 standards are being phased in --- # Tailpipe emission standards    --- # Tailpipe emission standards