uweights | R Documentation |
The small area estimates can be interpreted as weighted sums of the response variable. This function computes the weights corresponding to the aggregated small area estimates or the weights corresponding to a specific small area estimate. The weights applied to the response variable need not exactly reproduce the Hierarchical Bayes estimate since the latter is averaged over the posterior distribution for the variance ratio whereas the weights are evaluated at the posterior mean. Under the default prior for the fixed effects, the weights applied to the design matrix reproduce the corresponding population numbers.
uweights(x, areaID = NULL, forTotal = FALSE)
x |
sae object. |
areaID |
if left unspecified ( |
forTotal |
if |
An object of class weights
.
summary.weights
, plot.weights
d <- generateFakeData() # compute small area estimates sae <- fSAE(y0 ~ x + area2, data=d$sam, area="area", popdata=d$Xpop, method="hybrid", keep.data=TRUE) # compute unit weights w <- uweights(sae, forTotal=TRUE) summary(w) # summary statistics plot(w) # histogram of weights # checks all.equal(sum(w * sae$y), sum(EST(sae) * sae$Narea)) all.equal(colSums(w * as.matrix(sae$X)), colSums(sae$Xp * sae$Narea))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.