titanic: Titanic Data

Description Usage Format Source References Examples

Description

Data describes the survival status of individual passengers on the British luxury passenger liner Titanic that sank when it struck an iceberg on April 1912, on its maiden voyage to New York City from Southampton, England (Weisberg, 2003). Information were obtained from Encyclopedia Titanica. The variables on the dataset called titanic3 were made available by Harrell Jr (2001) and contains pclass, sex, embarked and survival status for each person on the board of the Titanic. pclass refers to passenger class (1st, 2nd, 3rd), and is a proxy for socio-economic class. embarked indicates the place where the passenger embarked on the ship. The variables pclass and embarked were recoded in the present version of the dataset. These data were used to compute prevalence ratios and corresponding confidence intervals.

Usage

1

Format

A data frame with 1307 observations on the following 4 variables:

pclass

The passenger class (1st, 2nd, 3rd) in the ship. Recoded to 1=1st class and 0=2nd or 3rd classes.

survived

The survival status of the passenger (1=yes, 0=no).

sex

Sex of the passenger (1=female, 0=male).

embarked

The place where the passenger embarked for the trip (Q=Queenstown, S=Southampton, C=Cherbourg). Recoded to 1=Queenstown or Cherbourg and 0=Southampton.

Source

The data were originally obtained from
Dawson, Robert J. MacG. (1995), The Unusual Episode Data Revisited. Journal of Statistics Education, 3. http://www.amstat.org/publications/jse/v3n3/datasets.dawson.html

References

Weisberg, S. (2005) Applied Linear Regression. Third Edition. New Jersey: John-Wiley & Sons.

Frank E. Harrell Jr (2001) Regression Modelling Strategies. New York: Springer-Verlag.

Examples

1
2
3
4
5
6
7
data("titanic", package = "prLogistic")
attach(titanic)
dim(titanic)
library(Hmisc)
describe(as.factor(pclass))
table(survived,pclass)
glm(survived ~ as.factor(pclass), family=binomial, data=titanic)

Example output

Loading required package: boot
Loading required package: stats4
Loading required package: lme4
Loading required package: Matrix
Loading required package: Hmisc
Loading required package: lattice

Attaching package: 'lattice'

The following object is masked from 'package:boot':

    melanoma

Loading required package: survival

Attaching package: 'survival'

The following object is masked from 'package:boot':

    aml

Loading required package: Formula
Loading required package: ggplot2

Attaching package: 'Hmisc'

The following objects are masked from 'package:base':

    format.pval, round.POSIXt, trunc.POSIXt, units

[1] 1307    4
as.factor(pclass) 
       n  missing distinct 
    1307        0        2 
                      
Value          0     1
Frequency    986   321
Proportion 0.754 0.246
        pclass
survived   0   1
       0 686 123
       1 300 198

Call:  glm(formula = survived ~ as.factor(pclass), family = binomial, 
    data = titanic)

Coefficients:
       (Intercept)  as.factor(pclass)1  
           -0.8271              1.3032  

Degrees of Freedom: 1306 Total (i.e. Null);  1305 Residual
Null Deviance:	    1737 
Residual Deviance: 1639 	AIC: 1643

prLogistic documentation built on May 1, 2019, 10:28 p.m.