R/inclusionprobastrata.R

inclusionprobastrata<-function (strata, nh) 
{   N = length(strata)
    EPS = 1e-6
    if (min(unique(strata)) < 1) 
        stop("the stratification variable has incorect values (less than 1)\n")
    Nh=as.vector(table(strata))
    if(any(nh/Nh>1+EPS)) warning("in a stratum the sample size is larger than the population size\n")
    pik=nh[strata]/Nh[strata]
    pik
}

Try the sampling package in your browser

Any scripts or data that you put into this service are public.

sampling documentation built on Nov. 2, 2023, 6:26 p.m.