processData: Process country data to run JAGS model

Description Usage Arguments Value

View source: R/processdata.R

Description

Function to process a country data to run a hierarchical model in JAGS. The function takes a dataframe with country codes, region codes, observations, observation years, standard errors and data source and returns data in form for input into JAGS.

Usage

1
2
3
processData(d, iso.column, data.column, se.column, obsyear.column,
  region.column = NULL, source.column = NULL, start.year = NULL,
  end.year = 2015)

Arguments

d

a dataframe that contains country codes/names, region codes/names, data column, observation years and standard error column

iso.column

string specifying name of column which contains country codes/names

data.column

string specifying name of column which contains observations

se.column

string specifying name of column which contains standard errors

obsyear.column

string specifying name of column which contains observation years

region.column

string specifying name of column which contains region codes/names. If NULL, the number of regions is 1 i.e. region is assumed to be the World.

source.column

string specifying name of column which contains data source. If NULL, the number of sources is assumed to be 1.

start.year

furst year for which estimates are required. If NULL, taken to be the minimum observation year.

end.year

final year for which estimates are required. Default is 2015.

Value

A list which includes matrices of data, observation years, source type and standard errors of dimensions c x i where c is the number of countries and i is the maximum number of observations. The list also includes counts of countries, regions, source types, years by country and starting years of each country, which are required to run the JAGS model.


MJAlexander/distortr documentation built on July 17, 2020, 4:06 p.m.