f<- function(x,b0,b1,b2,...) {b0+b1*x^b2}
g<- function(x,b3,...) {x^b3}
x<- 1 + sort( rgamma(5000, shape=4/9, scale=108) )
y<- simulatey(x,f,g,dist="gamma",b0=10,b1=1,b2=1,b3=1,rho=0.95)
st1<- optiallo(n=100,x=x,H=6)
vargreg("y~0",design="srs",n=100) #SRS-HT
vargreg("y~0",design="poi",n=100,x_des=x) #Poi-HT
vargreg("y~0",design="stsi",n=st1$nh,stratum=st1$stratum) #STSI-HT
vargreg("y~0",design="pips",n=100,x_des=x) #PIPS-HT
vargreg("y~x-1",design="srs",n=100,weights=1/x) #SRS-ratio
vargreg("y~x-1",design="poi",n=100,x_des=x,weights=1/x) #Poi-ratio
vargreg("y~x-1",design="stsi",n=st1$nh,
stratum=st1$stratum,weights=1/x) #STSI-ratio
vargreg("y~x-1",design="pips",n=100,x_des=x,weights=1/x) #PIPS-ratio
vargreg("y~x",design="srs",n=100) #SRS-reg
vargreg("y~x",design="poi",n=100,x_des=x) #Poi-reg
vargreg("y~x",design="stsi",n=st1$nh,stratum=st1$stratum) #STSI-reg
vargreg("y~x",design="pips",n=100,x_des=x) #PIPS-reg
x2<- as.factor(st1$stratum)
vargreg("y~x2",design="srs",n=100) #SRS-pos
vargreg("y~x2",design="poi",n=100,x_des=x) #Poi-pos
vargreg("y~x2",design="stsi",n=st1$nh,stratum=st1$stratum) #STSI-pos
vargreg("y~x2",design="pips",n=100,x_des=x) #PIPS-pos
y2<- c(16,21,18)
x2<- y2
inc.probs<- matrix(c(8,5,4,5,7,3,4,3,6),3,3)
vargreg("y2~0",n=2.1,inc.p=inc.probs) #HT
vargreg("y2~x2-1",n=2.1,inc.p=inc.probs,weights=1/x2) #Ratio
vargreg("y2~x2",n=2.1,inc.p=inc.probs) #Regression
x3<- as.factor(c(1,2,2))
vargreg("y2~x3",n=2.1,inc.p=inc.probs) #Post.
Run the code above in your browser using DataLab