dwww Home | Show directory contents | Find package

R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(survey)
Loading required package: grid
Loading required package: Matrix
Loading required package: survival

Attaching package: ‘survey’

The following object is masked from ‘package:graphics’:

    dotchart

> set.seed(42)
> 
> df<-data.frame(x=exp(rnorm(1000)))
> df$y<-round(df$x,1)
> ddf<-svydesign(id=~1,data=df)
Warning message:
In svydesign.default(id = ~1, data = df) :
  No weights or probabilities supplied, assuming equal probability
> rdf<-as.svrepdesign(ddf)
> 
> SE(oldsvyquantile(~x,ddf, c(0.01,0.1,0.5,0.9,0.99),ci=TRUE))
      0.01        0.1        0.5        0.9       0.99 
0.01543792 0.01264453 0.03386225 0.16131948 2.10605799 
> 
> SE(oldsvyquantile(~x,rdf, c(0.01,0.1,0.5,0.9,0.99),ci=TRUE))
               x
q0.01 0.01554946
q0.1  0.01425828
q0.5  0.03428012
q0.9  0.16457488
q0.99 1.88672412
> 
> SE(oldsvyquantile(~x,ddf, c(0.01,0.1,0.5,0.9,0.99),ci=TRUE,df=Inf))
      0.01        0.1        0.5        0.9       0.99 
0.01545209 0.01265608 0.03388011 0.16145776 2.10061576 
> 
> SE(oldsvyquantile(~x,rdf, c(0.01,0.1,0.5,0.9,0.99),ci=TRUE,df=Inf))
               x
q0.01 0.01556240
q0.1  0.01420086
q0.5  0.03430175
q0.9  0.16461019
q0.99 1.88818131
> 
> 
> oldsvyquantile(~y,ddf, c(0.01,0.1,0.5,0.9,0.99),ci=TRUE,ties="rounded",interval.type="betaWald")
$quantiles
        0.01       0.1       0.5  0.9 0.99
y 0.02352941 0.2230769 0.9340909 3.55  9.4

$CIs
, , y

             0.01       0.1       0.5      0.9      0.99
(lower 0.01594200 0.2020115 0.8578143 3.207543  7.568142
upper) 0.03287947 0.2467045 1.0059815 3.862241 14.978632


> 
> oldsvyquantile(~y,rdf, c(0.01,0.1,0.5,0.9,0.99),ci=TRUE)
Statistic:
        y
q0.01 0.1
q0.1  0.3
q0.5  1.0
q0.9  3.6
q0.99 9.4
SE:
               y
q0.01 0.02547977
q0.1  0.02547977
q0.5  0.02547977
q0.9  0.15287859
q0.99 1.88302540
> 
> oldsvyquantile(~y,ddf, c(0.01,0.1,0.5,0.9,0.99),ci=TRUE,ties="rounded",interval.type="betaWald",df=Inf)
$quantiles
        0.01       0.1       0.5  0.9 0.99
y 0.02352941 0.2230769 0.9340909 3.55  9.4

$CIs
, , y

             0.01       0.1       0.5      0.9      0.99
(lower 0.01594200 0.2020115 0.8578143 3.207543  7.568142
upper) 0.03287947 0.2467045 1.0059815 3.862241 14.978632


> 
> oldsvyquantile(~y,rdf, c(0.01,0.1,0.5,0.9,0.99),ci=TRUE, df=Inf)
Statistic:
        y
q0.01 0.1
q0.1  0.3
q0.5  1.0
q0.9  3.6
q0.99 9.4
SE:
               y
q0.01 0.02551067
q0.1  0.02551067
q0.5  0.02551067
q0.9  0.15306404
q0.99 1.88450896
> 
> 
> 
> df<-data.frame(x=exp(rnorm(20)))
> df$y<-round(df$x,1)
> ddf<-svydesign(id=~1,data=df)
Warning message:
In svydesign.default(id = ~1, data = df) :
  No weights or probabilities supplied, assuming equal probability
> rdf<-as.svrepdesign(ddf)
> SE(oldsvyquantile(~x,ddf, c(0.01,0.1,0.5,0.9,0.99),ci=TRUE))
      0.01        0.1        0.5        0.9       0.99 
0.03576771 0.07329496 0.30149917 2.03440784 1.88468597 
> 
> SE(oldsvyquantile(~x,rdf, c(0.01,0.1,0.5,0.9,0.99),ci=TRUE))
               x
q0.01 0.00000000
q0.1  0.04598541
q0.5  0.25943731
q0.9  2.12343073
q0.99 1.91998924
> 
> SE(oldsvyquantile(~x,ddf, c(0.01,0.1,0.5,0.9,0.99),ci=TRUE,df=Inf))
      0.01        0.1        0.5        0.9       0.99 
0.03637398 0.07470310 0.29938115 2.16381289 2.00708994 
> 
> SE(oldsvyquantile(~x,rdf, c(0.01,0.1,0.5,0.9,0.99),ci=TRUE,df=Inf))
               x
q0.01 0.00000000
q0.1  0.04732818
q0.5  0.24957966
q0.9  2.25211815
q0.99 2.04043154
> 
> 
> oldsvyquantile(~y,ddf, c(0.01,0.1,0.5,0.9,0.99),ci=TRUE,ties="rounded",interval.type="betaWald")
$quantiles
  0.01  0.1  0.5 0.9 0.99
y  0.1 0.15 0.75 2.4 8.68

$CIs
, , y

           0.01       0.1       0.5      0.9       0.99
(lower 0.100000 0.1000000 0.3674054 1.352279  0.5674674
upper) 1.132533 0.3464541 1.6303784 8.473337 10.2000000


> 
> oldsvyquantile(~y,rdf, c(0.01,0.1,0.5,0.9,0.99),ci=TRUE)
Statistic:
         y
q0.01 0.10
q0.1  0.20
q0.5  0.80
q0.9  2.40
q0.99 8.68
SE:
               y
q0.01 0.00000000
q0.1  0.02611112
q0.5  0.26542051
q0.9  2.10908603
q0.99 1.91777710
> 
> oldsvyquantile(~y,ddf, c(0.01,0.1,0.5,0.9,0.99),ci=TRUE,ties="rounded",interval.type="betaWald",df=Inf)
$quantiles
  0.01  0.1  0.5 0.9 0.99
y  0.1 0.15 0.75 2.4 8.68

$CIs
, , y

           0.01       0.1       0.5      0.9       0.99
(lower 0.100000 0.1000000 0.3674054 1.352279  0.5674674
upper) 1.132533 0.3464541 1.6303784 8.473337 10.2000000


> 
> oldsvyquantile(~y,rdf, c(0.01,0.1,0.5,0.9,0.99),ci=TRUE, df=Inf)
Statistic:
         y
q0.01 0.10
q0.1  0.20
q0.5  0.80
q0.9  2.40
q0.99 8.68
SE:
               y
q0.01 0.00000000
q0.1  0.02551067
q0.5  0.25244616
q0.9  2.23558589
q0.99 2.03881114
> 
> proc.time()
   user  system elapsed 
  1.791   0.148   2.936 

Generated by dwww version 1.15 on Thu May 23 18:56:37 CEST 2024.