Skip to content

Commit

Permalink
version 1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Glen Meeden authored and cran-robot committed Jun 12, 2017
1 parent fc9015a commit 3afc13a
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 40 deletions.
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: polyapost
Version: 1.4-3
Date: 2017-03-14
Version: 1.5
Date: 2017-06-12
Imports: boot, stats
Depends: R (>= 3.0.2), rcdd (>= 1.1-10)
Depends: R (>= 3.0.2), rcdd (>= 1.2)
Title: Simulating from the Polya Posterior
Author: Glen Meeden <glen@stat.umn.edu> and Radu Lazar
<lazar@stat.umn.edu> and Charles J. Geyer <charlie@stat.umn.edu>
Expand All @@ -14,6 +14,6 @@ Description: Simulate via Markov chain Monte Carlo (hit-and-run algorithm)
that is a subset of the unit simplex).
License: GPL (>= 2)
NeedsCompilation: yes
Packaged: 2017-03-14 21:57:45 UTC; geyer
Packaged: 2017-06-12 21:25:36 UTC; geyer
Repository: CRAN
Date/Publication: 2017-03-15 05:25:34
Date/Publication: 2017-06-12 23:09:46 UTC
18 changes: 9 additions & 9 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
d0c7287d45fe04dd2fefe24de4b372f0 *DESCRIPTION
4ad5c38bed4845c12bcbe3ee313ee992 *DESCRIPTION
b7608e4bdf9470a5d33898041a55e8e3 *NAMESPACE
af205ca09fab4fe4f460b9c4348eb85d *R/checkconstr.R
a24b9132c8639e5deaee307bc7fe9e23 *R/constrmat.R
Expand All @@ -7,18 +7,18 @@ a24b9132c8639e5deaee307bc7fe9e23 *R/constrmat.R
05b5b6f481312e763815463282aac5da *R/cwpolya.R
600fb1c902b0c084e6ccd9aaeea3ff7a *R/feasible.R
c6bdabbb7c3e74638991f0aa7d0f8988 *R/feasible1.R
abce94d7aeaad527b76013a71b6a2340 *R/hitrun.R
0c6c524c1b385fd19e49f9ffe4559985 *R/hitrun.R
945cc6bf2ed3409bc123f02f5bda1479 *R/means.R
8d8ddb268afce5ec9658b67bf362220f *R/nullspace.R
bde8037ae45667692d2a889433a73e31 *R/polyaest.R
a1a00e355ceb163ef53365bfca339836 *R/polyap.R
2be02f772609a4f9913e4bf2a30c876d *R/probvect.R
7901d2bcd10051987b69652cb5a12e05 *R/probvect1.R
be39dcf61a777387307071ea97d954aa *R/wtpolyap.R
557a6ad5428303216e760138b7423627 *build/vignette.rds
98df023f00dcc04d7d806e66a708ef82 *build/vignette.rds
bb237297199405f4d9a96542f83ca996 *inst/doc/pp1.R
a8f3f15f82ab29b69d5b2eca91871b09 *inst/doc/pp1.Rnw
990a9da7208925d86e2c081313003c69 *inst/doc/pp1.pdf
59ed7d248384662c24bf6c51f960546a *inst/doc/pp1.Rnw
7d34d7af65b4753cf58a1ca7aa4546ea *inst/doc/pp1.pdf
3b716132aa2bd8685f02914ffd67b2c1 *man/constrppmn.Rd
dd16907048de6ac08d118282acb818ee *man/constrppprob.Rd
9a9e1dfb73af54d6522d3901e9c7d48a *man/feasible.Rd
Expand All @@ -32,8 +32,8 @@ c0241c04b85b4ee2f65eab984c95d353 *src/Makevars
8de2f794828c82d8e868a9dc861a0e7d *src/means.c
d09330139cdab8b048fab14f91fe61e2 *src/polyapost.h
949b366c817a7df2fc83d142efe9d62d *src/probvect.c
6c8b99f22810226994b882e98443efe3 *tests/hitrun.R
8bc7f4c14f434edd4175ead3b450ddd0 *tests/hitrun.Rout.save
2b237a784a0c916c57e1c61331532b59 *tests/hitrun.R
9dfc01a0b1bf362f4b9a4cb1450cbd7b *tests/hitrun.Rout.save
5a9003046376ca7c471baa9bcdf926e7 *vignettes/charlie.bst
a8f3f15f82ab29b69d5b2eca91871b09 *vignettes/pp1.Rnw
20cd4814af718d87e8cc26ef7f292a6c *vignettes/ref.bib
59ed7d248384662c24bf6c51f960546a *vignettes/pp1.Rnw
27837cd23ede661b938ee0531693896c *vignettes/ref.bib
10 changes: 6 additions & 4 deletions R/hitrun.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# a1 and b1 can be missing
# a2 and b2 can be missing

# this file is now revised to follow the design document hitrun3.Rnw
# (in the devel directory) rather than the older hitrun.Rnw and hitrun2.Rnw
# this file is now revised to follow the design document hitrun4.Rnw
# (in the devel directory) rather than the older hitrun*.Rnw

hitrun <- function(alpha, ...)
UseMethod("hitrun")
Expand Down Expand Up @@ -191,19 +191,21 @@ hitrun.default <- function(alpha, a1 = NULL, b1 = NULL, a2 = NULL, b2 = NULL,
origin <- foo[is.point, ]
basis <- foo[is.line, , drop = FALSE]
basis <- t(basis)
# use new orthogonal basis function
basis <- qgram(basis)

# at this point
# fred <- function(x) origin + basis %*% x
# maps from new coordinates (NC) onto the affine hull
# of the constraint (a convex polytope) in original coordinated (OC)
# of the constraint (a convex polytope) in original coordinates (OC)

amat <- qneg(hrep4[ , - c(1, 2), drop = FALSE])
bvec <- hrep4[ , 2]
bvec <- qmq(bvec, qmatmult(amat, cbind(origin)))
amat <- qmatmult(amat, basis)

# at this point
# sally <- function(x) all(amat %*% x <= bvec)
# function(x) all(amat %*% x <= bvec)
# is the indicator function of a convex polytope in NC that is
# mapped one-to-one onto the constraint set in OC by the function
# fred defined in the previous comment
Expand Down
Binary file modified build/vignette.rds
Binary file not shown.
28 changes: 19 additions & 9 deletions inst/doc/pp1.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ The Polya posterior can be modified to take into account
available prior information about the population. This leads to
the constrained Polya posterior. More discussion about the theory
underlying the constrained Polya posterior can be found in
Lazar, Meeden and Nelson (2005). \nocite{l-m-n05}. The discussion
Lazar, Meeden and Nelson (2008). \nocite{l-m-n05}. The discussion
in this vignette will focus on using the constrained Polya
posterior to simulate completed copies of the population.

Expand Down Expand Up @@ -274,7 +274,7 @@ $\texttt{burnin} - 1$ simulated population means and returns the
remaining $\texttt{reps} - \texttt{burnin} + 1$
simulated population means. In this case we are keeping all of the
simulated means because $\texttt{burnin} = 1$.
We generated a total of $\texttt{reps}=100,001$ means. The average of these 200,001
We generated a total of $\texttt{reps}=200,001$ means. The average of these 200,001
is given in the output.
The plot of the first and each successive two hundredth simulated
population mean is given
Expand Down Expand Up @@ -317,6 +317,16 @@ out[[2]]
out[[3]]
@

Qu, Meeden and Zhang (2015) \nocite{qmz15} and Strief and Meeden (2014) \nocite{s-m14}
discuss two situations where the constrained Polya posterior yields good inference procedures.
In the first, they demonstrate that for some small area estimation problems
the constrained Polya posterior yields more robust procedures than standard methods.
In the second, they demonstrate that for each unit in a sample the constrained Polya
posterior can be used to find a weight. This weight can be given the usual interpretation
as the number of units in the population the sampled unit represents. These weights
can then be used to find good estimates of population parameters.


\subsection{Some computing issues}

\subsubsection{How long to run the chain}
Expand Down Expand Up @@ -463,13 +473,13 @@ wtpolyap(ysamp,wts,25)

\section{An example using the hitrun function}

A limitation of the function \texttt{constrppprob} is that it assumes that
given the sample the posterior
distribution of interest over the polytope defined by the constraints
is the uniform distribution. In practice one would like to be able to use
an arbitrary Dirichlet distribution as a possible posterior.
The \texttt{hitrun} function handles this more general
problem.

A limitation of the function \texttt{constrppprob} is that one cannot add any
constraints. In practice one would like to be able to find approximately
the expectation of the components of a constrained Dirichlet distribution.
The \texttt{hitrun} function handles this more general problem.



For a survey sampling example suppose
we have a population that is divided into two strata.
Expand Down
Binary file modified inst/doc/pp1.pdf
Binary file not shown.
1 change: 1 addition & 0 deletions tests/hitrun.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ foo <- vrep3[ , - c(1, 2)]
origin <- foo[is.point, ]
basis <- foo[is.line, ]
basis <- t(basis)
basis <- qgram(basis)
identical(q2d(origin), hout$origin)
identical(q2d(basis), hout$basis)

Expand Down
9 changes: 5 additions & 4 deletions tests/hitrun.Rout.save
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

R version 3.1.1 (2014-07-10) -- "Sock it to Me"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: i686-pc-linux-gnu (32-bit)
R version 3.4.0 (2017-04-21) -- "You Stupid Darkness"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Expand Down Expand Up @@ -97,6 +97,7 @@ See the Warnings sections added to help pages for
> origin <- foo[is.point, ]
> basis <- foo[is.line, ]
> basis <- t(basis)
> basis <- qgram(basis)
> identical(q2d(origin), hout$origin)
[1] TRUE
> identical(q2d(basis), hout$basis)
Expand Down Expand Up @@ -260,4 +261,4 @@ See the Warnings sections added to help pages for
>
> proc.time()
user system elapsed
0.756 0.028 0.790
0.568 0.008 0.573
28 changes: 19 additions & 9 deletions vignettes/pp1.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ The Polya posterior can be modified to take into account
available prior information about the population. This leads to
the constrained Polya posterior. More discussion about the theory
underlying the constrained Polya posterior can be found in
Lazar, Meeden and Nelson (2005). \nocite{l-m-n05}. The discussion
Lazar, Meeden and Nelson (2008). \nocite{l-m-n05}. The discussion
in this vignette will focus on using the constrained Polya
posterior to simulate completed copies of the population.

Expand Down Expand Up @@ -274,7 +274,7 @@ $\texttt{burnin} - 1$ simulated population means and returns the
remaining $\texttt{reps} - \texttt{burnin} + 1$
simulated population means. In this case we are keeping all of the
simulated means because $\texttt{burnin} = 1$.
We generated a total of $\texttt{reps}=100,001$ means. The average of these 200,001
We generated a total of $\texttt{reps}=200,001$ means. The average of these 200,001
is given in the output.
The plot of the first and each successive two hundredth simulated
population mean is given
Expand Down Expand Up @@ -317,6 +317,16 @@ out[[2]]
out[[3]]
@

Qu, Meeden and Zhang (2015) \nocite{qmz15} and Strief and Meeden (2014) \nocite{s-m14}
discuss two situations where the constrained Polya posterior yields good inference procedures.
In the first, they demonstrate that for some small area estimation problems
the constrained Polya posterior yields more robust procedures than standard methods.
In the second, they demonstrate that for each unit in a sample the constrained Polya
posterior can be used to find a weight. This weight can be given the usual interpretation
as the number of units in the population the sampled unit represents. These weights
can then be used to find good estimates of population parameters.


\subsection{Some computing issues}

\subsubsection{How long to run the chain}
Expand Down Expand Up @@ -463,13 +473,13 @@ wtpolyap(ysamp,wts,25)

\section{An example using the hitrun function}

A limitation of the function \texttt{constrppprob} is that it assumes that
given the sample the posterior
distribution of interest over the polytope defined by the constraints
is the uniform distribution. In practice one would like to be able to use
an arbitrary Dirichlet distribution as a possible posterior.
The \texttt{hitrun} function handles this more general
problem.

A limitation of the function \texttt{constrppprob} is that one cannot add any
constraints. In practice one would like to be able to find approximately
the expectation of the components of a constrained Dirichlet distribution.
The \texttt{hitrun} function handles this more general problem.



For a survey sampling example suppose
we have a population that is divided into two strata.
Expand Down
22 changes: 22 additions & 0 deletions vignettes/ref.bib
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,27 @@ @article{l-m-n05
TITLe="A noninformative {B}ayesian approach to finite population
sampling using auxiliary variables",
JOURNAL = "Survey Methodology",
volume = 34,
PAGES = "51--64",
year="2008"}


@article{qmz15,
AUTHOR = "Qu, Y. and Meeden, G. and Zhang, B.",
TITLE = "An objective stepwise Bayes approach to small area estimation",
JOURNAL = " Journal of Statistical Computation and Simulation",
PAGES = "1474--1494",
VOLUME = "85",
YEAR = "2015"
}


@article{s-m14,
AUTHOR = "Strief, J. and Meeden, G.",
TITLE = "Objective Stepwise Bayes Weights in Survey Sampling",
JOURNAL = "Survey Methodology",
VOLUME = "39",
PAGES = "1--27",
YEAR = "2014"}


0 comments on commit 3afc13a

Please sign in to comment.