nsum.internal.consistency | R Documentation |
use a leave-one-out method to estimate the predictive accuracy of the network scale-up estimator on the known populations
nsum.internal.consistency(
survey.data,
known.popns = NULL,
total.popn.size = NULL,
degrees = NULL,
missing = "ignore",
kp.method = TRUE,
weights = NULL,
alter.popn.size = NULL,
killworth.se = FALSE,
return.plot = FALSE,
verbose = FALSE,
bootstrap = FALSE,
...
)
survey.data |
the dataframe with the survey results |
known.popns |
if not NULL, a vector whose entries are the size of the known populations, and whose names are the variable names in the dataset corresponding to each one. if NULL, then assume that the survey.data dataframe has an attribute called 'known.popns' containing this vector. |
total.popn.size |
the size of the entire population. if NA,
this function works with proportions;
if NULL, it looks for the 'total.popn.size' attribute of the
dataset |
degrees |
if not NULL, then the name or index of the column in the datset
containing the degree estimates. if NULL, then use the known population
method to estimate the degrees (see |
missing |
if "ignore", then proceed with the analysis without doing anything about missing values. if "complete.obs" then only use rows that have no missingness for the computations (listwise deletion). care must be taken in using this second option |
kp.method |
if TRUE, then we're using known population method estimates of the degrees. this means we have to recompute the degrees each time we hold out a known subgroup. if the degrees come from another estimator, like the summation method, then we don't need to do that since we don't use the ARD questions in coming up with the degree estimate. |
weights |
if not NULL, weights to use in computing the estimate. this should be the name of the column in the survey.data which has the variable with the appropriate weights. these weights should be construted so that, eg, the mean of the degrees is estimated as (1/n) * \sum_i w_i * d_i |
alter.popn.size |
the size of the population of alters; this is most often the frame population, which is the default if nothing else is specified; the size of the frame population is taken to be the sum of the weights over all of survey.data |
killworth.se |
if TRUE, return the Killworth et al estimate of the standard error |
return.plot |
if TRUE, make and return a ggplot2 plot object |
verbose |
if TRUE, report more detailed information about what's going on |
bootstrap |
if TRUE, use |
... |
additional arguments, which are passed on to |
given a set of estimated degrees, responses to a group of ARD questions, and the total size of the populations that the ARD questions ask about, this function estimates the accuracy of the network scale-up method by dropping each known population in turn, using the non-dropped populations to compute the degree and an estimate of the size of the known population, and comparing the result to the actual size of the known population
* TODO – document bootstrap ci option better
* TODO – make amenable to parallelization
a list with a dataset containing the subpopn-specific estimates, as well as several summaries of the accuracy of those estimates, including mae (mean absolute error), mse (mean squared error), rmse (root mean squared error), and are (average relative error)
## Not run:
ic.result <-
nsum.internal.consistency(survey.data=recoded.dat,
known.popns=kp.totals,
missing="complete.obs",
killworth.se=TRUE,
kp.method=TRUE,
alter.popn.size=total.popn.size,
return.plot=TRUE,
bootstrap=TRUE,
bootstrap.fn="rescaled.bootstrap.sample",
survey.design=~ cluster,
num.reps=100)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.