Type: Package
Title: Supporting Files and Functions for the Book Bayesian Modelling with 'JAGS'
Version: 0.1.1
Description: All the data and functions used to produce the book. We do not expect most people to use the package for any other reason than to get simple access to the 'JAGS' model files, the data, and perhaps run some of the simple examples. The authors of the book are David Lucy (now sadly deceased) and James Curran. It is anticipated that a manuscript will be provided to Taylor and Francis around February 2020, with bibliographic details to follow at that point. Until such time, further information can be obtained by emailing James Curran.
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
Depends: R (≥ 3.5.0)
Imports: formatR, glue, graphics, stats
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.1
NeedsCompilation: no
Packaged: 2019-07-18 04:07:24 UTC; jcur002
Author: James Curran [aut, cre], David Lucy [aut]
Maintainer: James Curran <j.curran@auckland.ac.nz>
Repository: CRAN
Date/Publication: 2019-07-19 10:30:02 UTC

jaggR: Supporting files and functions for the book Bayesian Modelling with JAGS

Description

A set of functions used in teaching STATS 201/208 Data Analysis at the University of Auckland. The functions are designed to make parts of R more accessible to a large undergraduate population who are mostly not statistics majors.

Author(s)

James Curran, David Lucy


Age estimation from aspartic acid concentration

Description

Aspartic acid data for modern upper and lower first pre-molars: taken from Gillard et al 1991

Usage

acid.df

Format

A data.frame with 37 rows and 3 columns:

age

Age in years.

period

Period of tooth, modern or victorian.

aspartic

Percentage of D-aspartic acid.

Source

Gillard, R.D., Hardman, S.M., Pollard, A.M., Sutton, P.A. and Whittaker, D.K. (1991) 'Determinations of age at death in the archaeological populations using the D/L ratio of aspartic acid in dental collagen' in Archaeometry 90, eds. Pernicka, E. and Wagner, G.A., p.637-644, Birkhauser Verlag, Berlin.


Energy requirements for different activities

Description

An experiment was conducted to compare the energy requirements of three physical activities: running, walking and bicycle riding. Eight subjects were asked to run, walk and bicycle a measured distance, and the number of kilocalories expended per kilometre was measured for each subject during each activity. The activities are run in random order with time for recovery between activities. Each activity was monitored exactly once for each individual.

Usage

activity.df

Format

A data.frame with 24 rows and 3 columns:

subject

a subject ID.

activity

running, walking, riding.

energy

energy expended during activity, in kilocalories (Cal)

Source

Milton, J. S. (1992). Statistical Methods in the Biological and Health Sciences 2nd Edition, McGraw-Hill, New York, p. 316–319.


Calculus marks

Description

Calculus marks from the 2012 first year calculus course from the Department of Mathematics and Statistics at Lancaster University.

Usage

calculus.df

Format

A data.frame with 147 rows and two columns:

coursework

final coursework mark out of 100.

examination

final examination mark out of 100.

Source

George Moran, Department of Mathematics and Statistics at Lancaster.


Carbon isotopes in trees

Description

These observations were made by Robertson et. al. They are the mean delta 13 C compositions of several individual trees from two locations in Central England mean temperatures from the CET are also given

Usage

carbon.df

Format

A data.frame with 200 rows and 4 columns:

year
iso
temp

Cell survival data

Description

The data comes from an experiment to measure the mortality of cancer cells under radiation under taken in the Department of Radiology, University of Cape Town. Four hundred cells were placed on a dish, and three dishes were irradiated at a time, or occasion. After the cells were irradiated, the surviving cells were counted. Since cells would also die naturally, dishes with cells were put into the radiation chamber without being irradiated, to establish the natural mortality. These data gives only these zero-dose data. these data are from ozDASL

Usage

cell_surv.df

Format

An object of class data.frame with 27 rows and 2 columns.


Energy and fat in chocolate bars

Description

The amount of fat (g) and energy (Cal) in 16 chocolate bars. Source is unknown, but we would be happy to give credit if someone tells us.

Usage

chocolate.df

Format

A data.frame with 16 rows and 2columns:

energy

energy, in Calories = kilocalories

fat

fat content, in grams

Source

Source is unknown, but we would be happy to give credit if someone tells us.


Does insulation make a difference?

Description

This data arose from an experiment conducted by David to testing the insulation of the ground floor bedroom of his house–The Spinney. The idea was that the better the insulation the slower the rate cooling, so for some exponential model y(t) = y(0) exp(-lambda t) - the value of lambda should go down for a better insulated room In the experiment, David ran two extension cords into the room through a service port to power two electric heaters and a fan. He then sealed up the room by shutting windows and door. The heaters were left to heat up the room as much as they could. This happened to be about 24.6 C. He then turned the heaters and fan off and the recorded the rate of cooling by observing a temperture probe from outside the room for about two hours. Standard theory says that the rate of cooling is proportional to the temperature differential between the indoor and outdoor temperatures. To control for this days were selected which had approximately the same external temperatures. The room has walls which are external and internal. It was assumed that the outside and internal house (no heating) had reached an equilibrium so that we only need to know the outside room, but inside house temperature rather than both

Usage

cooling.df

Format

A data.frame with 47 rows and 3 columns:

time

The time since turning off the heaters and fan

uninsulated

The recorded temperature with absolutely no insulation in the room whatsoever—outside temperature 8.0 C.

insulated

The recorded temperature with part of a wall and the floor insulated— outside temperature 8.1 C

Source

David Lucy


Get a JAGS model file

Description

This function provides an easy way for readers to get the JAGS model files used in the book. The modelID is the 4-5 character identifier used in the book. For example to get 'model-001.bugs.R', you would use getModel("001").

Usage

getModel(modelID)

Arguments

modelID

a string containing a valid model ID

Value

a string containing the model. The intention is that this can be written to disk.

Examples

getModel("001")

Age estimation based on changes in dental characteristics

Description

Age estimation based on changes in dental characteristics

Usage

gustafson.df

Format

a data.frame with 759 rows and 10 columns:

sex

sex of subject, female or male.

age

age, in years.

quadrant

location in mouth of tooth

tooth

tooth identifier

attrition
recession
dentine

qualitative assessment of remaining dentine


Hedgehog growth

Description

Hedgehog growth

Usage

hedgehog.growth.df

Format

a data.frame with 77 rows and 2 columns:

date

Date in DD-Month-YYYY format

weight

weight of the hedgehog, in grams

Source

David Lucy


Hedgehog survival

Description

The Bunnell Index (or BI) is a measurement of how tightly the hedgehog are curled into a ball. One measurement is taken round the middle of the animal to cross at the point where the nose ends ("A," latitudinal circumference). The other measurement, using a second tape measure already secured underneath the animal, is taken round the hedgehog from head to tail ("B," longitudinal circumference). Care must be taken with both measurements to ensure that the ends of the tape measure meet easily without altering the shape/positioning of the hedgehog. When obtaining measurement A, the positioning of the tape measure is crucial; a measurement taken lower down toward the tail can result in a lower (inaccurate) reading. Repeatedly measuring many hedgehogs over several consecutive days demonstrated consistent BI values and hence the reliability of the method. A is divided by B to give a value for the BI. It is important to determine the BI value to two decimal places (i.e., a value of 0.794, becomes 0.79, while a value of 0.805 becomes 0.81).

Usage

hedgehog.survival.df

Format

A data.frame with 31 observations and 2 columns:

BI

The Bunnell Index (BI) of the hedgehog at the time of admission.

survived

A logical variable recording whether the hedgehog survived or died.

Source

Bunnell, T. (2002) The Assessment of British Hedgehog (Erinaceus europaeus) Casualties on Arrival and Determination of Optimum Release Weights Using a New IndexJournal of Wildlife Rehabilitation 25 (4):11-21


Impact strength of insulation cuts in foot-pounds.

Description

Impact strength of insulation cuts in foot-pounds.

Usage

insulation.df

Format

a data.frame with 100 rows and 3 colums:

Lot

Lot of insulating material

Cut

Lengthwise (Length) or crosswise (Cross)

Strength

Impact strength, in foot-pounds (ft-lb)

Source

Ostle, B. (1963). Statistics in Research: Basic Concepts and Techniques for Research. Ames, Iowa. Iowa State University Press.


Distance travelled by paper planes

Description

A group from Queensland University of Technology conducted an experiment where they recorded the distance flown by paper aeroplanes. The experimenters used a sealed corridor at the University, and controlled the design of the aeroplane, the weight of the paper from which each aeroplace was constructed, and the angle of incidence at launch for each paper plane. The data and further notes for this experiment can be found at http://www.statsci.org/data/oz/planes.html.

Usage

plane.df

Format

A data.frame with 16 rows and 5 columns:

distance

Distance travelled in mm.

paper

Paper weight in grams per square metre (gsm), either 80 gsm or 50 gsm.

angle

Angle of launch, horizontal or 45 degrees.

design

Design of the plane, either high performance or simple.

Source

Mackisack, M. S. (1994). What is the use of experiments conducted by statistics students? Journal of Statistics Education, 2, no 1.


from the Commission facility in Hanford, Washington. One of the major safety problems encountered there has been the storage of radioactive wastes. Over the years, significant quantities of these substances - including strontium 90 and cesium 137 - have leaked from their open-pit storage areas into the nearby Columbia River, which flows along the Washington-Oregon border, and eventually empties into the Pacific Ocean.

Description

To measure the health consequences of this contamination, an index of exposure was calculated for each of the nine Oregon counties having frontage on either the Columbia River or the Pacific Ocean. This particular index was based on several factors, including the county's stream distance from Hanford and the average distance of its population from any water frontage. As a covariate, the cancer mortality rate was determined for each of these same counties. The data give the index of exposure and the cancer mortality rate during 1959-1964 for the nine Oregon counties affected. Higher index values represent higher levels of contamination.

Usage

radiation.df

Format

An object of class data.frame with 9 rows and 3 columns.

Source

Fadeley, R. C. (1965). Oregon malignancy pattern physiographically related to Hanford, Washington, Radioisotope Storage. Journal of Environmental Health 27, 883-897.


Times taken for a rat to navigate through a maze

Description

Times taken for a rat to navigate through a maze

Usage

ratmaze.df

Format

A data.frame with 135 rows and 4 columns:

subject

An ID for each rat

treatment

The treatment adminstered to the subject: control/none, thouiracil, thyroxin.

test

A maze number.

time

time, in seconds taken for the rat to navigate the maze.


Age estimation by root dentine translucency

Description

Root dentine translucency is, in humans, an age related physiological feature. In the dentine of teeth in adult humans the tubecular microstructures fill with a highly crystalline substance making them become nearly invisible when looked at in normal light. This process starts from the apical foramen in early adulthood, and progresses up the tooth into advanced old age. Solheim (Lucy et al., 1996) collected data on age, root dentine translucency for 71 maxillary second incisors from a Norweigian population. The sex of each individual was also noted.

Usage

rdt.df

Format

A data.frame with 71 rows and 3 columns:

age

Age of subject, in years

sex

Sex of subject, female or male

rdt

root dentine translucency

Source

Lucy, D., Aykroyd, R.G., Pollard, A.M. and Solheim (1996), T.,"A Bayesian approach to adult human age estimation from dental observations by Johanson's age changes", Journal of Forensic Sciences 41(2):189-194.


Set Plotting Preferences

Description

Set Plotting Preferences

Usage

setPlotPrefs(mar = c(3, 4, 1, 1), cex = 1, oma = c(0, 0, 0, 0),
  tcl = -0.35, mgp = c(1.5, 0.5, 0), las = 1, cex.lab = 1,
  font.lab = 1, lwd = 1, on.graph.line = 3, shading.density = 8,
  arrow.length = 0.1, on.graph.cex = 1, margin.cex = 1.2, ...)

Arguments

mar

plot margings

cex

character expansion factor

oma

outer margins

tcl

tick length

mgp

somethen

las

text rotation on axes

cex.lab

plot labels cex

font.lab

font of plot labels

lwd

line width

on.graph.line

no idea

shading.density

shading density

arrow.length

arrow head length

on.graph.cex

character expansion for text on graphs

margin.cex

character expansion for text for margins

...

other arguments to be passed to par

Value

the previous par settings so that they can be restored


Simulated weights of difference breeds of terriers

Description

Simulated samples of weights from English terrier breeds with the parameter values for the means for the simulation taken from http://www.dogsindepth.com. The variances are assumed to be constant.

Usage

terriers.df

Format

A data.frame with 30 rows and 2 columns.

weight

Weight of dog in kg.

breed

Breed, either Skye, Manchester or Norwich.


Tidy BUGS files

Description

This function cleans up the formatting

Usage

tidy_bugs(path = ".", arrow = TRUE, brace.newline = FALSE,
  indent = 2)

Arguments

path

location of file(s)

arrow

use the <- operator if TRUE, = otherwise.

brace.newline

move braces to a new line if TRUE

indent

number of spaces to indent code blocks

mirror server hosted at Truenetwork, Russian Federation.