View source: R/GetDataWrappers.R
GetDataWrappers | R Documentation |
Only partly tested
GetDataWrappers()
ImputeHistoryW(
data,
idName,
strataName = NULL,
yVar,
yearName,
fun = ImputeHistory,
...
)
ImputeHistoryNewNamesW(..., fun = ImputeHistoryNewNames)
ImputeHistoryTallW(..., fun = ImputeHistoryTall)
ImputeHistoryTallSmallW(..., fun = ImputeHistoryTallSmall)
ImputeHistoryWideW(..., fun = ImputeHistoryWide)
ImputeHistoryTallWideWSmall(..., fun = ImputeHistoryWideSmall)
ImputeRegressionW(
data,
idName,
strataName,
xName,
yName,
yearName,
fun = ImputeRegression,
...
)
ImputeRegressionNewNamesW(..., fun = ImputeRegressionNewNames)
ImputeRegressionTallW(..., fun = ImputeRegressionTall)
ImputeRegressionTallSmallW(..., fun = ImputeRegressionTallSmall)
ImputeRegressionWideW(..., fun = ImputeRegressionWide)
ImputeRegressionWideSmallW(..., fun = ImputeRegressionWideSmall)
OutlierRegressionW(..., fun = OutlierRegression)
OutlierRegressionTallW(..., fun = OutlierRegressionTall)
OutlierRegressionWideW(..., fun = OutlierRegressionWide)
OutlierRegressionMicroW(..., fun = OutlierRegressionMicro)
ImputeRegression2W(
data,
idName,
strataName,
xName,
yName,
yearName,
fun = ImputeRegression2,
...
)
ImputeRegression2NewNamesW(..., fun = ImputeRegression2NewNames)
ImputeRegression2TallW(..., fun = ImputeRegression2Tall)
ImputeRegression2TallSmallW(..., fun = ImputeRegression2TallSmall)
ImputeRegression2WideW(..., fun = ImputeRegression2Wide)
ImputeRegression2WideSmallW(..., fun = ImputeRegression2WideSmall)
ImputeHistoryW
and similar functions takes yVar and yearName as input insetad of xName and yName.
ImputeRegressionW
and OutlierRegressionW
and similar functions takes yearName as extra parameter.
Output is from last year.
ImputeRegression2W
and similar functions takes xName and yearName as input insetad of x1Name and x2Name. The
function takes y using yName from last year, x1 using yName from the previous year and x2 using yName from last year.
Here yearName must be a variable name. For the other variables variable numbers will also work.
See the other functions
rateData <- KostraData("rateData") # Real Kostra data set
w <- rateData$data[, c(17,19,16,5)] # Data with id, strata, x and y
w <- w[is.finite(w[,"Ny.kostragruppe"]), ] # Remove Longyearbyen
w[w[,"Ny.kostragruppe"]>13,"Ny.kostragruppe"]=13 # Combine small strata
# Create historical data by modifying the "original x-variable"
w2=cbind(w,x1=1.2*w[,3]*rep(c(NA,NA,1,1),107),x2=1.1*w[,3]*rep(c(NA,1),214))
# Create stacked variant of data
w3 = Stack(w2,c(4,5,6,3),1:2,data.frame(aar=2013:1026),"y")
a <- ImputeHistory(w2, strataName = 2, xName=c(5,6,3), yName=4)
b <- ImputeHistoryW(w3, idName=1, strataName = 2, yVar="y", yearName="aar")
identical(a,b)
a = ImputeHistoryTallSmall(w2, strataName = 2, xName=c(5,6,3), yName=4)
b = ImputeHistoryTallSmallW(w3, idName=1, strataName = 2, yVar="y", yearName="aar")
identical(a,b)
a <- ImputeRegression(w, strataName = 2, method="ratio")
b <- ImputeRegressionW(cbind(w,aar=2016), idName=1, strataName = 2, xName=3, yName=4, yearName="aar", method="ratio")
identical(a,b)
a <- ImputeRegressionTallSmall(w, strataName = 2, method="ratio")
b <- ImputeRegressionTallSmallW(cbind(w,aar=2016), idName=1, strataName = 2, xName=3, yName=4, yearName="aar", method="ratio")
identical(a,b)
a <- OutlierRegressionMicro(w, strataName = 2, method="ratio")
b <- OutlierRegressionMicroW(cbind(w,aar=2016), idName=1, strataName = 2, xName=3, yName=4, yearName="aar", method="ratio")
identical(a,b)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.