Example: Replicating st0399 results"

  collapse = TRUE,
  comment = "#>"

The ccostr package includes a dataset called "hcost". The dataset comes from the Stata package of the same name [@Chen2015], and we can therefore use it both as an example and to verify that the two packages reach similar estimates. First we look at the data:


Now we use the ccmean function with a limit of 4 years (1461 days), we also add the interpolation term which affects the interpolation of cost between two observed time points. By default this parameter is set to zero, but to replicate the results of the Stata implementation we set it to 1.

est <- ccmean(hcost, L = 1461, addInterPol = 1)

These estimates are similar to what is found with the hcost Stata package. We can also plot these with the included generic plot function:



Try the ccostr package in your browser

Any scripts or data that you put into this service are public.

ccostr documentation built on Sept. 9, 2019, 5:03 p.m.