#' Title
#'
#' @param model
#'
#' @return
#' @export
#'
#' @examples
psusample <- function(model){
if(!is(model,"crowd")) stop("Argument not valid")
y_list = unlist(model$y)
nn = model$nn
NN = model$NN
N = sum(NN)
n = sum(nn)
sample_index <- sample(N, n)
y_sample <- y_list[sample_index]
# HT estimator and variance
Htest<- mean(y_sample)
var<-var(y_sample)
var_Htest<- var/(sqrt(n))
out <- list(method = "Post sampling Uncorrected",
Htest = mean(Htest),
var_Htest = mean(var_Htest),
y_sample = y_sample,
model = model
)
class(out) <- "crowdsample"
return(out)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.