You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In tandem with adding simulation results to cf objects, we need to write extractor functions to pull out point estimates, lower bounds, and upper bounds.
I'm open to suggestions as to what to call these functions. pe() should work for point estimates; lower() and upper() would be nice, but maybe they conflict with a popular package? If not, we could have very simple names.
The only required input would be the cf object, and so
pe(yhyp)
should return all the point estimates in the cf object yhyp.
But you could specify subsets, so
pe(yhyp, scen=5:10, cat=2, period=1:10, eq=1)
would indicate scenarios 5 to 10 in the second category of a categorical outcome variable, and only in periods 5 to 10 of forecasts into the future, and only in the second equation of a multi-equation model. (Obviously not all of these arguments will apply in a specific case; and eq is there for future compatibility.) lower() and upper() also will have a ci argument.
The extractors will look in the cf object to learn the dimensions of the it's simulations, then return the requested segments in whatever format (vector, matrix, array). The cf argument will also provide information of what levels each confidence interval corresponds to.
These extractor functions can be used by end users, but also by tile traces when they encounter a cf object.
The text was updated successfully, but these errors were encountered:
So this is some preliminary code for the extractor model. One thing we need to answer for lower and upper is whether people need to have already simulated the confidence intervals or with the new counterfactual object, we can go and redo this for them on the fly.
cfpe <- function(cf, scen=NULL, cat=NULL, period=NULL, eq=NULL) {
#if (cf$cfMake.call[["eqtype"]]) %in% c("simple")) {
if (is.vector(cf[["pe"]])) cf[["pe"]] <- as.matrix(cf[["pe"]])
#dim doesn't work on vectors. Should make this a matrix please
peDim <- dim(cf[["pe"]])
if(is.null(scen)) assign("scen", seq(1, peDim[1]))
if(is.null(cat)) assign("cat", seq(1, peDim[2]))
pe.out <- cf[["pe"]][scen, cat] #we can go an recalculate from original simulates ornot
#}
return(pe.out)
}
In tandem with adding simulation results to
cf
objects, we need to write extractor functions to pull out point estimates, lower bounds, and upper bounds.I'm open to suggestions as to what to call these functions.
pe()
should work for point estimates;lower()
andupper()
would be nice, but maybe they conflict with a popular package? If not, we could have very simple names.The only required input would be the
cf
object, and sope(yhyp)
should return all the point estimates in the
cf
objectyhyp
.But you could specify subsets, so
would indicate scenarios 5 to 10 in the second category of a categorical outcome variable, and only in periods 5 to 10 of forecasts into the future, and only in the second equation of a multi-equation model. (Obviously not all of these arguments will apply in a specific case; and
eq
is there for future compatibility.)lower()
andupper()
also will have aci
argument.The extractors will look in the
cf
object to learn the dimensions of the it's simulations, then return the requested segments in whatever format (vector, matrix, array). Thecf
argument will also provide information of what levels each confidence interval corresponds to.These extractor functions can be used by end users, but also by tile traces when they encounter a
cf
object.The text was updated successfully, but these errors were encountered: