MortalityTables_Austria_Census.R 5.76 KB
Newer Older
1
stopifnot(require(methods), require(utils), require(MortalityTables)) # MortalityTable classes; new; Excel reader
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
2 3 4 5 6 7


###############################################################################
### Volkszählungen Österreich
###############################################################################

8

9 10
a.vz.dataM = utils::read.csv(system.file("extdata", "Austria_Census_Male.csv", package = "MortalityTables"), skip = 3);
a.vz.dataF = utils::read.csv(system.file("extdata", "Austria_Census_Female.csv", package="MortalityTables"), skip = 3);
11

12 13 14 15 16 17 18 19
censtable = function(data, name, qslot, baseYear=1900, sex = "m") {
  qx = data[names(data) == qslot];
  ix = complete.cases(qx);
  mortalityTable.period(name = name, ages = data$x[ix], deathProbs = qx[ix,], baseYear = baseYear,
      data = list(
          dim = list(sex = s, collar = "Gesamtbevölkerung", type = "Volkssterbetafel Österreich", data = "official", year = baseYear)
      )
  )
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
20 21
}

22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
mort.AT.census.1869.male = censtable(a.vz.dataM, name="ÖVSt 1868/71 M",   baseYear=1869, qslot="X1868.71", sex = "m")
mort.AT.census.1880.male = censtable(a.vz.dataM, name="ÖVSt 1879/82 M",   baseYear=1880, qslot="X1879.82", sex = "m")
mort.AT.census.1890.male = censtable(a.vz.dataM, name="ÖVSt 1889/92 M",   baseYear=1890, qslot="X1889.92", sex = "m")
mort.AT.census.1900.male = censtable(a.vz.dataM, name="ÖVSt 1899/1902 M", baseYear=1900, qslot="X1899.1902", sex = "m")
mort.AT.census.1910.male = censtable(a.vz.dataM, name="ÖVSt 1909/12 M",   baseYear=1910, qslot="X1909.12", sex = "m")
mort.AT.census.1931.male = censtable(a.vz.dataM, name="ÖVSt 1930/33 M",   baseYear=1931, qslot="X1930.33", sex = "m")
mort.AT.census.1951.male = censtable(a.vz.dataM, name="ÖVSt 1949/51 M",   baseYear=1951, qslot="X1949.51", sex = "m")
mort.AT.census.1961.male = censtable(a.vz.dataM, name="ÖVSt 1959/61 M",   baseYear=1961, qslot="X1959.61", sex = "m")
mort.AT.census.1971.male = censtable(a.vz.dataM, name="ÖVSt 1970/72 M",   baseYear=1971, qslot="X1970.72", sex = "m")
mort.AT.census.1981.male = censtable(a.vz.dataM, name="ÖVSt 1980/82 M",   baseYear=1981, qslot="X1980.82", sex = "m")
mort.AT.census.1991.male = censtable(a.vz.dataM, name="ÖVSt 1990/92 M",   baseYear=1991, qslot="X1990.92", sex = "m")
mort.AT.census.2001.male = censtable(a.vz.dataM, name="ÖVSt 2000/02 M",   baseYear=2001, qslot="X2000.02", sex = "m")
mort.AT.census.2011.male = censtable(a.vz.dataM, name="ÖVSt 2010/2012 M", baseYear=2011, qslot="X2010.12", sex = "m")

mort.AT.census.1869.female = censtable(a.vz.dataF, name="ÖVSt 1868/71 F",   baseYear=1869, qslot="X1868.71", sex = "w")
mort.AT.census.1880.female = censtable(a.vz.dataF, name="ÖVSt 1879/82 F",   baseYear=1880, qslot="X1879.82", sex = "w")
mort.AT.census.1890.female = censtable(a.vz.dataF, name="ÖVSt 1889/92 F",   baseYear=1890, qslot="X1889.92", sex = "w")
mort.AT.census.1900.female = censtable(a.vz.dataF, name="ÖVSt 1899/1902 F", baseYear=1900, qslot="X1899.1902", sex = "w")
mort.AT.census.1910.female = censtable(a.vz.dataF, name="ÖVSt 1909/12 F",   baseYear=1910, qslot="X1909.12", sex = "w")
mort.AT.census.1931.female = censtable(a.vz.dataF, name="ÖVSt 1930/33 F",   baseYear=1931, qslot="X1930.33", sex = "w")
mort.AT.census.1951.female = censtable(a.vz.dataF, name="ÖVSt 1949/51 F",   baseYear=1951, qslot="X1949.51", sex = "w")
mort.AT.census.1961.female = censtable(a.vz.dataF, name="ÖVSt 1959/61 F",   baseYear=1961, qslot="X1959.61", sex = "w")
mort.AT.census.1971.female = censtable(a.vz.dataF, name="ÖVSt 1970/72 F",   baseYear=1971, qslot="X1970.72", sex = "w")
mort.AT.census.1981.female = censtable(a.vz.dataF, name="ÖVSt 1980/82 F",   baseYear=1981, qslot="X1980.82", sex = "w")
mort.AT.census.1991.female = censtable(a.vz.dataF, name="ÖVSt 1990/92 F",   baseYear=1991, qslot="X1990.92", sex = "w")
mort.AT.census.2001.female = censtable(a.vz.dataF, name="ÖVSt 2000/02 F",   baseYear=2001, qslot="X2000.02", sex = "w")
mort.AT.census.2011.female = censtable(a.vz.dataF, name="ÖVSt 2010/2012 F", baseYear=2011, qslot="X2010.12", sex = "w")

mort.AT.census.2001.unisex = mortalityTable.mixed(table1=mort.AT.census.2001.male, table2=mort.AT.census.2001.female,
    data = list(
        dim = list(sex = "u", collar = "Gesamtbevölkerung", type = "Volkssterbetafel Österreich", data = "official", year = 2001)    
    )
)
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
55

56
mort.AT.census.ALL.male = MortalityTables::makeQxDataFrame(
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
57 58 59 60 61 62 63 64 65 66 67 68 69 70
              mort.AT.census.1869.male,
              mort.AT.census.1880.male,
              mort.AT.census.1890.male,
              mort.AT.census.1900.male,
              mort.AT.census.1910.male,
              mort.AT.census.1931.male,
              mort.AT.census.1951.male,
              mort.AT.census.1961.male,
              mort.AT.census.1971.male,
              mort.AT.census.1981.male,
              mort.AT.census.1991.male,
              mort.AT.census.2001.male,
              mort.AT.census.2011.male);

71
mort.AT.census.ALL.female = MortalityTables::makeQxDataFrame(
Reinhold Kainhofer's avatar
Reinhold Kainhofer committed
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
              mort.AT.census.1869.female,
              mort.AT.census.1880.female,
              mort.AT.census.1890.female,
              mort.AT.census.1900.female,
              mort.AT.census.1910.female,
              mort.AT.census.1931.female,
              mort.AT.census.1951.female,
              mort.AT.census.1961.female,
              mort.AT.census.1971.female,
              mort.AT.census.1981.female,
              mort.AT.census.1991.female,
              mort.AT.census.2001.female,
              mort.AT.census.2011.female);

rm(a.vz.dataM, a.vz.dataF, censtable)

###############################################################################

90 91
# plot(mort.AT.census.ALL.male, title="Vergleich österreichische Sterbetafeln, Männer", legend.position=c(1,0))
# plot(mort.AT.census.ALL.female, title="Vergleich österreichische Sterbetafeln, Frauen", legend.position=c(1,0))
92