library(idep)
library(dplyr)
library(stringr)
library(magrittr)
load("Z:/Gesch\xe4ftsordnungen/database/aggregats/isom.Rdata")
# version check 
data_path  <- "z:/gesch\u00e4ftsordnungen/database/extracts/"
db_on_disk_version <- 
  str_extract(list.files(data_path), "\\d+\\.\\d+") %>% 
  as.numeric()  %>% 
  max(na.rm=T)
db_on_disk_version
set.seed(7787)
options("width"=100)
Sys.setlocale("LC_TIME", "English")

IDEP Standing Orders Minority-Majority-Change Dataset \newline (version: r isom$db_isom_lastupdate[1])

The data-set is a compilation of data based on several data-sets: ERD European Represantatives Dataset, Release 3, February 2014, ISOR IDEP Standing Orders Reform Dataset, version r db_on_disk_version and ParlGov Parliaments and governments database, 2012 release.

All information are aggregate on cabinet level with one row per cabinet. Cabinet information stems from ERD. Information on Standing Orders reforms was added from ISOR data-set by matching reform dates (date of acceptance of the reform or if not available earliest date available) into cabinet time spans (and countries) for information on reforms. For information on the Standing Orders present for a particular cabinet matching was done by overlapping time spans from SO and cabinet. All measures of ideological positions, distances and polarization come from CMP which was merged/joined with ParlGov first (ParlGov includes the CMP party id variable). ParlGov in turn was used as source for volatility measures. Having merged/joined ParlGov and CMP, this combined data-set was than joined with ERD by matching cabinet start dates (automatically and by hand due to occasional differing start days).

The data set incorporates aggregated data for r dim(isom)[1] - length(unique(isom$country)) cabinets in r length(unique(substring(isom$country,1,3))) countries and consists of r dim(isom)[2] variables.

Example:

#### R-code: #### 

isom  %>% 
  select( ctr, cab_pm, cab_in, cab_out, wds_chg_sum,  pro_minmaj_qual, 
          idl_pnt_all,  volatility ) %>% 
  mutate(
    idl_pnt_all = round(idl_pnt_all, 1), 
    volatility  = round(volatility, 1)
  )

Citing the Data

Publications using this data-set should acknowledge in writing that the information comes from:

Andersson, Staffan; Bergman, Torbjörn; Ersson, Svante (2014). The European Representative Democracy Data Archive, Release 3. Main sponsor: Riksbankens Jubileumsfond (In2007-0149:1-E). [www.erdda.se]

Döring, Holger; Manow, Philip (2015). Parliaments and governments database (ParlGov): Information on parties, elections and cabinets in modern democracies. Version: 2013.

Lehmann, Pola; Matthieß, Theres; Merz, Nicolas; Regel, Sven; Werner, Annika (2015): Manifesto Corpus. Version: 2013-b. Berlin: WZB Berlin Social Science Center.

Sieberer, Ulrich; Meißner, Peter; Keh, Julia; Müller, Wolfgang C. (2015): ISOR - IDEP Standing Orders Reforms Date-set.

Sieberer, Ulrich; Meißner, Peter; Keh, Julia; Müller, Wolfgang C. (2015): ISOM - IDEP Standing Orders Minority-Majority Date-set.

Tsebelis, George (2002): Veto Players. How Political Institutions Work. Princeton UP.

References used in the Codebook

ERD:

ERD (2014): European Representative Democracy (ERD) Release 3.0 February 12, 2014 Code-book for ERD - e.

CMP:

CMP (2015): Manifesto Project Data-set Code-book. Website: https://manifesto-project.wzb.eu/. Version: 2015a

Volatility

Pedersen, Mogens N. (1979): The Dynamics of European Party Systems: Changing Patterns of Electoral Volatility. European Journal of Political Research, 7/1, 1-26. http://janda.org/c24/Readings/Pedersen/Pedersen.htm

Variable Descriptions

Notes

The variables of the ISOR data-set are extensively described in a separate code-book (isor_codebook.pdf) -- therefore only some of those variables are presented here.

Since there might be more than one SO reform (ISOR) that took place during the course of a cabinet, ISOR data had to be aggregated:

source("C:/Dropbox/RPackages/idep/inst/tasks/aggregate_data/variable_description_isom.r")
load(system.file("tasks/aggregate_data/var_desc_isor.Rdata", package="idep"))
miss_names <- names(isom)[!(names(isom) %in% var_desc_isom$name)]

for ( m in miss_names ){
  ms <- str_replace(m, "_mn$|_fst$|_all$|_lst$|_sum$", "")
  if ( sum(grepl(ms, var_desc_isor$name) > 0) ){
    tmp <- var_desc_isor[var_desc_isor$name == ms,]
    tmp$name <- m
    tmp$group <- "ISOR"
    tmp$from <- paste("ISOR", tmp$from, sep=", ")
    if ( grepl("all$", tmp$name ) ) {
      tmp$desc <- 
      paste(tmp$desc, "(all within cabinet, might be truncated in Stata version)")
    }
    if ( grepl("fst$", tmp$name ) ) {
      tmp$desc <- 
        paste(tmp$desc, "(first value within cabinet duration)")
    }
    if ( grepl("lst$", tmp$name ) ) {
      tmp$desc <- paste(tmp$desc, "(last value within cabinet duration)")
    }
    if ( grepl("sum$", tmp$name ) ) {
      tmp$desc <- paste(tmp$desc, "(sum of all values within cabinet duration)")
    }
    if ( grepl("mn$", tmp$name ) ) {
      tmp$desc <- paste(tmp$desc, "(mean of all values within cabinet duration)")
    }
    var_desc_isom <- rbind(var_desc_isom, tmp)
  }
}
sumdummy<-function(x){
  ifelse(
    class(x) == "character" | class(x) == "Date", 
    "-", 
    format(sum(x, na.rm=TRUE), scientific = F, big.mark = "\xA0") 
  )
}
sumvar <- function(x){
  cat("**`class    :`** `", 
      str_pad(class(x)               , 
              12, "left", "\u00A0") ,"`\\\n<br>")
  cat("**`unique   :`** `", 
      str_pad(length(unique(x))      , 
              12, "left", "\u00A0") ,"`\\\n<br>")
  cat("**`NAs      :`** `", 
      str_pad(sum(is.na(x))          , 
              12, "left", "\u00A0") ,"`\\\n<br>")
  cat("**`not-NA   :`** `", 
      str_pad(sum(!is.na(x))         , 
              12, "left", "\u00A0") ,"`\\\n<br>")
  cat("**`not-0-NA :`** `", 
      str_pad(sum(!is.na(x) & x!=0 ) , 
              12, "left", "\u00A0") ,"`\\\n<br>")
  cat("**`sum      :`** `", 
      str_pad(sumdummy(x)            , 
              12, "left", "\u00A0") ,"`\\\n<br>")
  cat(
      "**`range    :`** `[", 
    as.character(range(x, na.rm=T)[1]), 
    "] ... [",
    as.character(range(x, na.rm=T)[2]),
    "]",
    "`\\\n<br>"
  )
  cat(
      "**`examples :`** `", 
    paste0(substring(
      paste0("[",  paste(sample(x,10), collapse="], [", sep="") ,   "]"),
    0,80),""),
    "...",
    "`\\\n<br>"
  )
}
for( g in sort(unique(var_desc_isom$group)) ){
  gtitle <- str_replace(g, "^\\d* ", "")
  cat(paste0("\n## ", gtitle, "\n\n"))
  dat <- var_desc_isom  %>% filter(group==g)
  for( i in seq_len(dim(dat)[1]) ){
    cat(
      "\n\n**", dat$name[i], "** (", dat$from[i] ,")", "\n\n",
      dat$desc[i], "\n\n",
      sep=""
    )
    tryCatch(
      {
        sumvar(as.data.frame(isom, stringsAsFactors=F)[ , dat$name[i] ])
      },
      error = function(e){
        message("ERROR: Variable not found in dataset!")
        stop()
      }
    )
    cat("\n\n<p>&nbsp;</p>")
  }
}

r paste(names(isom)[!(names(isom) %in% var_desc_isom$name)], collapse="\n\n")



petermeissner/idep documentation built on May 25, 2019, 1:53 a.m.