# NOT RUN {
library(sregsurvey)
library(survey)
library(dplyr)
library(gamlss)
data(api)
attach(apipop)
Apipop <- filter(apipop,full!= 'NA')
Apipop <- filter(Apipop, stype == 'H')
Apipop <- Apipop %>% dplyr::select(api00,grad.sch,full,api99)
n=ceiling(0.25*dim(Apipop)[1])
aux_var <- Apipop %>% dplyr::select(api99)
sreg_pips(api00 ~ pb(grad.sch), scale_formula = ~ full - 1, data= Apipop, x= aux_var, n=n)
# The total population value is
sum(Apipop$api00)
# }
Run the code above in your browser using DataLab