shuttle_sim: Simulate fake space shuttle data

Description Usage Arguments Details Value See Also Examples

View source: R/shuttle_sim.R

Description

Simulates fake O-ring thermal distress data for Challenger Space Shuttle launches at different launch temperatures. The simulated data are based on a linear logistic regression model fitted to the real data from the 23 (pre-disaster) launches.

Usage

1
shuttle_sim(n_sim = 1, temperature = NULL)

Arguments

n_sim

A integer scalar. The number of fake datasets to simulate.

temperature

A numeric vector of launch temperatures.

If temperature is not supplied then the 23 launch temperatures from the real dataset are used.

If temperature is supplied then it must be a vector of length one (i.e. a scalar). In this event n_sim gives the number of simulated numbers of damaged O-rings at launch temperature temperature. If temperature has length greater than one then only the first element of temperature is used and a warning is given.

Details

The data are simulated from a linear logistic regression model fitted to the real (pre-disaster) O-ring distress and launch temperature data. For a given launch temperature t this model provides an estimate, phat(t) say, of the probability that an O-ring suffers thermal distress. Then the number of the 6 O-rings that suffers from thermal distress is simulated from a binomial(6, phat(t)) distribution, under an assumption that the fates of the O-rings are independent. This is repeated for each of the launch temperatures in temperatures. For further details see the Challenger Space Shuttle Disaster vignette.

Value

The output depends on whether or not temperature is supplied by the user.

If temperature is supplied then shuttle_sim returns a dataframe with 2 + n_sim columns. Column 1 contains the launch temperatures, column 2 contains the numbers of distressed O-rings in the real data and columns 3 to 2 + n_sim the n_sim simulated datasets.

If temperature is not supplied then shuttle_sim returns a vector of length n_sim.

See Also

The Challenger Space Shuttle Disaster vignette.

shuttle_sim_plot for assessing uncertainty concerning the modelling of the space shuttle data using simulation.

Examples

1
2
3
4
5
6
7
# Simulate 10 fake datasets of size 23, using the real temperatures.
res <- shuttle_sim(n_sim = 10)
res
# Simulate the number of distressed O-rings for 1000 launches at 31 deg F.
res <- shuttle_sim(n_sim = 1000, temperature = 31)
res[1:100]
table(res)

paulnorthrop/stat1004 documentation built on Nov. 17, 2019, 3:49 a.m.