R 패키지 메타데이터와 수집 신호를 모아 봅니다.
첫 화면에서 판단해야 할 수집 신호를 먼저 배치합니다.
DESCRIPTION에서 감지한 backend 관련 package입니다.
기본 메타데이터를 작은 카드와 토큰으로 압축합니다.
| Package | Type | Spec |
|---|---|---|
| sampling CRAN · 0.1.5 · 2026-05-30 | Imports | sampling |
| 검색 결과가 없습니다. | ||
| Package | Type | Spec |
|---|---|---|
| 표시할 dependency edge가 없습니다. | ||
| 검색 결과가 없습니다. | ||
README code{white-space: pre-wrap;} span.smallcaps{font-variant: small-caps;} span.underline{text-decoration: underline;} div.column{display: inline-block; vertical-align: top; width: 50%;} div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} ul.task-list{list-style: none;} pre > code.sourceCode { white-space: pre; position: relative; } pre > code.sourceCode > span { display: inline-block; line-height: 1.25; } pre > code.sourceCode > span:empty { height: 1.2em; } .sourceCode { overflow: visible; } code.sourceCode > span { color: inherit; text-decoration: inherit; } div.sourceCode { margin: 1em 0; } pre.sourceCode { margin: 0; } @media screen { div.sourceCode { overflow: auto; } } @media print { pre > code.sourceCode { white-space: pre-wrap; } pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; } } pre.numberSource code { counter-reset: source-line 0; } pre.numberSource code > span { position: relative; left: -4em; counter-increment: source-line; } pre.numberSource code > span > a:first-child::before { content: counter(source-line); position: relative; left: -1em; text-align: right; vertical-align: baseline; border: none; display: inline-block; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; padding: 0 4px; width: 4em; color: #aaaaaa; } pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } div.sourceCode { } @media screen { pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } } code span.al { color: #ff0000; font-weight: bold; } /* Alert */ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ code span.at { color: #7d9029; } /* Attribute */ code span.bn { color: #40a070; } /* BaseN */ code span.bu { color: #008000; } /* BuiltIn */ code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ code span.ch { color: #4070a0; } /* Char */ code span.cn { color: #880000; } /* Constant */ code span.co { color: #60a0b0; font-style: italic; } /* Comment */ code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ code span.do { color: #ba2121; font-style: italic; } /* Documentation */ code span.dt { color: #902000; } /* DataType */ code span.dv { color: #40a070; } /* DecVal */ code span.er { color: #ff0000; font-weight: bold; } /* Error */ code span.ex { } /* Extension */ code span.fl { color: #40a070; } /* Float */ code span.fu { color: #06287e; } /* Function */ code span.im { color: #008000; font-weight: bold; } /* Import */ code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ code span.kw { color: #007020; font-weight: bold; } /* Keyword */ code span.op { color: #666666; } /* Operator */ code span.ot { color: #007020; } /* Other */ code span.pp { color: #bc7a00; } /* Preprocessor */ code span.sc { color: #4070a0; } /* SpecialChar */ code span.ss { color: #bb6688; } /* SpecialString */ code span.st { color: #4070a0; } /* String */ code span.va { color: #19177c; } /* Variable */ code span.vs { color: #4070a0; } /* VerbatimString */ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ jipApprox Description This package provides functions to approximate joint-inclusion probabilities in Unequal Probability Sampling, or to find Monte Carlo approximations of first and second-order inclusion probabilities of a general sampling design. The main functions are: jip_approx() : returns a matrix of approximated joint-inclusion probabilities for unequal probability sampling design with high entropy; jip_MonteCarlo() : produces a matrix of first and second order inclusion probabilities for a given sampling design, approximated through Monte Carlo simulation. This method of approximation is more flexible but also computer-intensive. HTvar() : returns the Horvitz-Thompson or Sen-Yates-Grundy variance or their estimates, computed using true inclusion probabilities or an approximation obtained by jip_approx() or jip_MonteCarlo() . Installation The development version of the package can be installed from GitHub: # if not present, install 'devtools' package install.packages ( "devtools" ) devtools :: install_github ( "rhobis/jipApprox" ) Usage library (jipApprox) ### Generate population data --- N <- 20 ; n <- 5 set.seed ( 0 ) x <- rgamma ( 500 , scale= 10 , shape= 5 ) y <- abs ( 2 * x + 3.7 * sqrt (x) * rnorm (N) ) pik <- n * x / sum (x) ### Approximate joint-inclusion probabilities for high entropy designs --- pikl <- jip_approx (pik, method= 'Hajek' ) pikl <- jip_approx (pik, method= 'HartleyRao' ) pikl <- jip_approx (pik, method= 'Tille' ) pikl <- jip_approx (pik, method= 'Brewer1' ) pikl <- jip_approx (pik, method= 'Brewer2' ) pikl <- jip_approx (pik, method= 'Brewer3' ) pikl <- jip_approx (pik, method= 'Brewer4' ) ### Approximate inclusion probabilities through Monte Carlo simulation --- pikl <- jip_MonteCarlo ( x= pik, n = n, replications = 100 , design = "brewer" ) pikl <- jip_MonteCarlo ( x= pik, n = n, replications = 100 , design = "tille" ) pikl <- jip_MonteCarlo ( x= pik, n = n, replications = 100 , design = "poisson" ) pikl <- jip_MonteCarlo ( x= pik, n = n, replications = 100 , design = "maxEntropy" ) pikl <- jip_MonteCarlo ( x= pik, n = n, replications = 100 , design = "randomSystematic" ) pikl <- jip_MonteCarlo ( x= pik, n = n, replications = 100 , design = "systematic" ) pikl <- jip_MonteCarlo ( x= pik, n = n, replications = 100 , design = "sampford" ) More Please, report any bug or issue here . For more information, please contact the maintainer at rob.sichera@gmail.com .Help for package jipApprox const macros = { "\\R": "\\textsf{R}", "\\mbox": "\\text", "\\code": "\\texttt"}; function processMathHTML() { var l = document.getElementsByClassName('reqn'); for (let e of l) { katex.render(e.textContent, e, { throwOnError: false, macros }); } return; } Package {jipApprox} Contents jipApprox-package HTvar brewer excludeSSU is.wholenumber jipDFtoM jipMtoDF jip_Brewer jip_Hajek jip_HartleyRao jip_MonteCarlo jip_Tille jip_approx maxEntropy pre_CPS pre_tille sampford save_output tille Title: Approximate Inclusion Probabilities for Survey Sampling Version: 0.1.5 Date: 2023-08-26 Description: Approximate joint-inclusion probabilities in Unequal Probability Sampling, or compute Monte Carlo approximations of the first and second-order inclusion probabilities of a general sampling design as in Fattorini (2006) < doi:10.1093/biomet/93.2.269 >. Depends: R (≥ 4.0.0) License: GPL-3 Encoding: UTF-8 BugReports: https://github.com/rhobis/jipApprox/issues RoxygenNote: 7.2.3 Imports: sampling NeedsCompilation: no Packaged: 2023-08-26 08:11:03 UTC; Roberto Author: Roberto Sichera [aut, cre] Maintainer: Roberto Sichera <rob.sichera@gmail.com> Repository: CRAN Date/Publication: 2023-08-26 08:40:02 UTC jipApprox: Approximate inclusion probabilities for survey sampling Description Approximate joint-inclusion probabilities in Unequal Probability Sampling, or compute Monte Carlo approximations of the first and second-order inclusion probabilities of a general sampling design as in Fattorini (2006) <doi:10.1093/biomet/93.2.269>. Approximation of Joint-inclusion probabilities Function jip_approx provides a number of approximations of the second-order inclusion probabilities that require only the first-order inclusion probabilities. These approximations may be employed in unequal probability sampling design with high entropy. A more flexible approximation may be obtained by using function jip_MonteCarlo , which estimates inclusion probabilities through a Monte Carlo simulation. The variance of the Horvitz-Thompson total estimator may be then estimated by plugging the approximated joint probabilities into the Horvitz-Thompson or Sen-Yates-Grundy variance estimator using function HTvar . Author(s) Maintainer : Roberto Sichera rob.sichera@gmail.com References Matei, A.; Tillé, Y., 2005. Evaluation of variance approximations and estimators in maximum entropy sampling with unequal probability and fixed sample size. Journal of Official Statistics 21 (4), 543-570. Haziza, D.; Mecatti, F.; Rao, J.N.K. 2008. Evaluation of some approximate variance estimators under the Rao-Sampford unequal probability sampling design. Metron LXVI (1), 91-108. Fattorini, L. 2006. Applying the Horvitz-Thompson criterion in complex designs: A computer-intensive perspective for estimating inclusion probabilities. Biometrika 93 (2), 269-278 See Also Useful links: Report bugs at https://github.com/rhobis/jipApprox/issues Variance of the Horvitz-Thompson estimator Description Compute or estimate the variance of the Horvitz-Thompson total estimator by the Horvitz-Thompson or Sen-Yates-Grundy variance estimators. Usage HTvar(y, pikl, sample = TRUE, method = "HT") Arguments y numeric vector representing the variable of interest pikl matrix of second-order (joint) inclusion probabilities; the diagonal must contain the first-order inclusion probabilities. sample logical value indicating whether sample or population values are provided. If sample=TRUE , the function returns a sample estimate of the variance, while if sample=FALSE , the Variance is computed over all population units. Default is TRUE. method string, indicating if the Horvitz-Thompson ( "HT" ) or the Sen-Yates-Grundy ( "SYG" ) estimator should be computed. Details The Horvitz-Thompson variance is defined as \sum_{i\in U}\sum_{j \in U} \frac{(\pi_{ij} - \pi_i\pi_j)}{\pi_i\pi_j} y_i y_j which is estimated by \sum_{i\in U}\sum_{j \in U} \frac{(\pi_{ij} - \pi_i\pi_j)}{\pi_i\pi_j\pi_{ij}} y_i y_j The Sen-Yates-Grundy variance is obtained from the Horvitz-Thompson variance by conditioning on the sample size n, and is therefore only appliable to fixed size sampling designs: \sum_{i\in U}\sum_{j > i} (\pi_i\pi_j - \pi_{ij}) \Biggl(\frac{y_i}{\pi_i} - \frac{y_j}{\pi_j} \Biggr)^2 Its estimator is \sum_{i\in U}\sum_{j > i} \frac{(\pi_i\pi_j - \pi_{ij})}{\pi_{ij}} \Biggl(\frac{y_i}{\pi_i} - \frac{y_j}{\pi_j} \Biggr)^2 Examples ### Generate population data --- N <- 500; n <- 50 set.seed(0) x <- rgamma(500, scale=10, shape=5) y <- abs( 2*x + 3.7*sqrt(x) * rnorm(N) ) pik <- n * x/sum(x) pikl <- jip_approx(pik, method='Hajek') ### Dummy sample --- s <- sample(N, n) ### Compute Variance --- HTvar(y=y, pikl=pikl, sample=FALSE, method="HT") HTvar(y=y, pikl=pikl, sample=FALSE, method="SYG") ### Estimate Variance --- #' HTvar(y=y[s], pikl=pikl[s,s], sample=TRUE, method="HT") #' HTvar(y=y[s], pikl=pikl[s,s], sample=TRUE, method="SYG") Brewer sampling procedure ————————————————– Description Brewer sampling procedure ————————————————– Usage brewer(pik, n, N, s, list) Arguments pik vector of first-order inclusion probabilities n sample size N population size s vector of length N, with 1s at the positions of self-selecting units list vector with positions of self selcting units Note this function is a modified version of function UPbrewer , from the sampling package. Exclude self-selecting units Description Exclude self-selecting units and units with probability zero and returns a list with parameters needed to perform sampling Usage excludeSSU(pik, eps = 1e-06) Arguments pik vector of first-order inclusion probabilities eps control value for pik Note the code is taken from package sampling Check if a number is integer Description Check if x is an integer number, differently from is.integer , which checks the type of the object x Usage is.wholenumber(x, tol = .Machine$double.eps^0.5) Arguments x a scalar or a numeric vector tol a scalar, indicating the tolerance Note From the help page of function is.integer Transform a Joint-Inclusion Probability data.frame to a matrix Description Transform a Joint-Inclusion Probability data.frame to a matrix Usage jipDFtoM(jip, symmetric = TRUE) Arguments jip vector or data.frame containing the joint-inclusion probabilities symmetric boolean, if TRUE , returns a symmetric matrix, otherwise, an upper triangular matrix Value a symmetric matrix of joint-inclusion probabilities if TRUE , otherwise, an upper triangular matrix Transform a matrix of Joint-Inclusion Probabilities to a data.frame Description Transform a matrix of Joint-Inclusion Probabilities to a data.frame Usage jipMtoDF(jip, id = NULL) Arguments jip a square matrix of joint-inclusion probabilities, symmetric or upper-triangular id optional, vector of id labels, its length should be equal to ncol(jip) and nrow(jip) Brewer's joint-inclusion probability approximations Description Approximation of joint inclusion probabilities by one of the estimators proposed by Brewer and Donadio (2003) Usage jip_Brewer(pik, method) Arguments pik numeric vector of first-order inclusion probabilities for all population units. method string representing one of the available approximation methods. Details "Brewer18" is the approximation showed in equation (18) of Brewer and Donadio (2003) Hájek's joint-inclusion probability approximation Description Estimate joint-inclusion probabilities using Hájek (1964) equation Usage jip_Hajek(pik) Arguments pik numeric vector of first-order inclusion probabilities for all population units. Hartley-Rao approximation of joint-inclusion probabilities Description Approximation of joint-inclusion probabilities with precision of order O(N^{-4}) for the random systematic sampling design by Hartley and Rao (1962), pag. 369 eq. 5.15 Usage jip_HartleyRao(pik) Arguments pik numeric vector of first-order inclusion probabilities for all population units. Approximate inclusionCompute or estimate the variance of the Horvitz-Thompson total estimator by the Horvitz-Thompson or Sen-Yates-Grundy variance estimators.
HTvar(y, pikl, sample = TRUE, method = "HT")### Generate population data --- N <- 500; n <- 50 set.seed(0) x <- rgamma(500, scale=10, shape=5) y <- abs( 2*x + 3.7*sqrt(x) * rnorm(N) ) pik <- n * x/sum(x) pikl <- jip_approx(pik, method='Hajek') ### Dummy sample --- s <- sample(N, n) ### Compute Variance --- HTvar(y=y, pikl=pikl, sample=FALSE, method="HT") HTvar(y=y, pikl=pikl, sample=FALSE, method="SYG") ### Estimate Variance --- #' HTvar(y=y[s], pikl=pikl[s,s], sample=TRUE, method="HT") #' HTvar(y=y[s], pikl=pikl[s,s], sample=TRUE, method="SYG")Brewer sampling procedure --------------------------------------------------
brewer(pik, n, N, s, list)Exclude self-selecting units and units with probability zero and returns a list with parameters needed to perform sampling
excludeSSU(pik, eps = 1e-06)Check if x is an integer number, differently from is.integer, which checks the type of the object x
is.wholenumber(x, tol = .Machine$double.eps^0.5)Approximate joint-inclusion probabilities in Unequal Probability Sampling, or compute Monte Carlo approximations of the first and second-order inclusion probabilities of a general sampling design as in Fattorini (2006) <doi:10.1093/biomet/93.2.269>.
Transform a Joint-Inclusion Probability data.frame to a matrix
jipDFtoM(jip, symmetric = TRUE)Transform a matrix of Joint-Inclusion Probabilities to a data.frame
jipMtoDF(jip, id = NULL)Approximation of joint inclusion probabilities by one of the estimators proposed by Brewer and Donadio (2003)
jip_Brewer(pik, method)Estimate joint-inclusion probabilities using Hájek (1964) equation
jip_Hajek(pik)Approximation of joint-inclusion probabilities with precision of order O(N^-4) for the random systematic sampling design by Hartley and Rao (1962), pag. 369 eq. 5.15
jip_HartleyRao(pik)Approximate first and second-order inclusion probabilities by means of Monte Carlo simulation. Estimates are obtained as proportion of the number of occurrences of each unit or couple of units over the total number of replications. One unit is added to both numerator and denominator to assure strict positivity of estimates (Fattorini, 2006).
jip_MonteCarlo( x, n, replications = 1e+06, design, units, seed = NULL, as_data_frame = FALSE, design_pars, write_on_file = FALSE, filename, path, by = NULL, progress_bar = TRUE )### Generate population data --- N <- 20; n<-5 set.seed(0) x <- rgamma(N, scale=10, shape=5) y <- abs( 2*x + 3.7*sqrt(x) * rnorm(N) ) pik <- n * x/sum(x) ### Approximate joint-inclusion probabilities pikl <- jip_MonteCarlo(x=pik, n = n, replications = 100, design = "brewer") pikl <- jip_MonteCarlo(x=pik, n = n, replications = 100, design = "tille") pikl <- jip_MonteCarlo(x=pik, n = n, replications = 100, design = "maxEntropy") pikl <- jip_MonteCarlo(x=pik, n = n, replications = 100, design = "randomSystematic") pikl <- jip_MonteCarlo(x=pik, n = n, replications = 100, design = "systematic") pikl <- jip_MonteCarlo(x=pik, n = n, replications = 100, design = "sampford") pikl <- jip_MonteCarlo(x=pik, n = n, replications = 100, design = "poisson") #Use an external function to draw samples pikl <- jip_MonteCarlo(x=pik, n=n, replications=100, design = sampling::UPmidzuno, design_pars = list(pik=pik)) #Write output on file after 50 and 100 replications pikl <- jip_MonteCarlo(x=pik, n = n, replications = 100, design = "brewer", write_on_file = TRUE, filename="test.txt", path=tempdir(), by = 50 )Compute the approximation of joint-inclusion probabilities by means of the Iterative Proportional Fitting Procedure (IPFP) proposed by Tillé (1996)
jip_Tille(pik, eps = 1e-06, maxIter = 1000)Approximations of joint-inclusion probabilities by means of first-order inclusion probabilities.
jip_approx(pik, method)### Generate population data --- N <- 20; n<-5 set.seed(0) x <- rgamma(N, scale=10, shape=5) y <- abs( 2*x + 3.7*sqrt(x) * rnorm(N) ) pik <- n * x/sum(x) ### Approximate joint-inclusion probabilities --- pikl <- jip_approx(pik, method='Hajek') pikl <- jip_approx(pik, method='HartleyRao') pikl <- jip_approx(pik, method='Tille') pikl <- jip_approx(pik, method='Brewer1') pikl <- jip_approx(pik, method='Brewer2') pikl <- jip_approx(pik, method='Brewer3') pikl <- jip_approx(pik, method='Brewer4')Draw a sample by means of Conditional Poisson Sampling
maxEntropy(pik, N, q)Compute matrix of selection probabilities for Conditional Poisson Sampling
pre_CPS(pik)Computes a matrix with elimination probabilities for each step of Tillé's elimination procedure
pre_tille(pik)Draw a sample by means of Rao-Sampford sampling
sampford(pik, n, N, s, list)Write joint inclusion probability estimates on a file every by replications
save_output( iteration, design_name, counts, units, filename, path, status, as_data_frame )Draw a sample by means of Tillé's elimination procedure
tille(pik, n, N, s, list, pmat)| Repository | Version | Published | First seen | Last seen | Docs |
|---|---|---|---|---|---|
| CRAN | 0.1.5 | 2026-05-29 | 2026-05-30 |
표시할 OSV 데이터가 없습니다.
표시할 OpenAlex 데이터가 없습니다.