array.yourcast: Array generation tool for YourCast

Description Usage Arguments Value Author(s) References See Also Examples

Description

Creates array from YourCast output for each geographical unit.

Usage

1

Arguments

x

A yourcast output object.

unlog

Logical. Should the dependent variable be unlogged? Default: FALSE.

Value

Creates array(s) from yourcast output. One array is created per geographic area. If there is one geographic area, an array is returned; else, a named list of arrays is returned. Each array is of size T (number of times) by A (number of ages) by 3, where the last dimension captures the type of data: y (observed values), yhat (predicted values), and comb (observed values in-sample and predicted values out-of-sample).

Author(s)

Konstantin Kashin kkashin@fas.harvard.edu.

References

http://gking.harvard.edu/yourcast

See Also

yourcast function and documentation (help(yourcast))

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Run Lee-Carter model for Figure 2.6 in Demographic Forecasting
data(chp.2.6.1)
ff.allc <- log(allc2/popu2) ~  time	
ylc.allc <- yourcast(formula=ff.allc, dataobj=chp.2.6.1, model="LC",
                       elim.collinear=FALSE,
                       sample.frame=c(1950,2000,2001,2060))
                       
yc.array <- array.yourcast(ylc.allc)
names(yc.array)

# predicted mortality rates (observed in-sample and predicted out-of-sample)
# for geographic area '4150'
yc.array[["4150"]][,,"comb"]

IQSS/YourCast documentation built on May 7, 2019, 6:03 a.m.