Skip to contents

A file, df_data, has grouping variables ar_svr_group and a data variable svr_data (e.g., population), measured at sequential svr_date (e.g., year, month) dates. There are nonconsecutive gaps in svr_data measurements, with missing values in some dates. We use the rate of change between the closest dates in which there is data to linearly interpolate svr_data in dates with missing values. The output is stored in variable svr_interp.

Usage

ff_ppts_interp_linear(
  df_data,
  ar_svr_group = c("location", "variable"),
  svr_data = c("population"),
  svr_date = c("year"),
  svr_interp = c("population_interp1"),
  verbose = FALSE
)

Arguments

df_data

data frame with various time-series/panel with missing data

ar_svr_group

array of grouping variable names, panel groups

svr_data

string variable name for data variable

svr_date

string variable name for date variable

svr_interp

string variable name for variable with interpolated values

verbose

Boolean print details

Value

A dataset with interpolated values

Author

Fan Wang, http://fanwangecon.github.io