Skip to content

Commit

Permalink
version 1.1-5
Browse files Browse the repository at this point in the history
  • Loading branch information
Glen Meeden authored and gaborcsardi committed Mar 24, 2014
1 parent 579abc3 commit a5d6962
Show file tree
Hide file tree
Showing 7 changed files with 261 additions and 226 deletions.
9 changes: 5 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: polyapost
Version: 1.1-2
Date: 2012-03-20
Version: 1.1-5
Date: 2014-03-24
Imports: boot
Title: Simulating from the Polya posterior
Author: Glen Meeden <glen@stat.umn.edu> and Radu Lazar
Expand All @@ -9,6 +9,7 @@ Maintainer: Glen Meeden <glen@stat.umn.edu>
Description: Generate dependent samples from a non-full dimensional
polytope via a Markov Chain sampler
License: GPL (>= 2)
Packaged: 2012-03-20 21:43:39 UTC; geyer
Packaged: 2014-03-31 15:31:22 UTC; gmeeden
NeedsCompilation: yes
Repository: CRAN
Date/Publication: 2012-03-21 07:59:39
Date/Publication: 2014-03-31 19:12:35
9 changes: 5 additions & 4 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
6dfb3163322449f6682c7b130ccabcd6 *DESCRIPTION
25268d2f476215eb0fec68bbd8f1cd6c *DESCRIPTION
c76df6367ec5ce07212d916fcc833e16 *NAMESPACE
af205ca09fab4fe4f460b9c4348eb85d *R/checkconstr.R
a24b9132c8639e5deaee307bc7fe9e23 *R/constrmat.R
Expand All @@ -14,11 +14,10 @@ a1a00e355ceb163ef53365bfca339836 *R/polyap.R
2be02f772609a4f9913e4bf2a30c876d *R/probvect.R
d2d0660f39acf21c1149c4945c4c8b48 *R/probvect1.R
be39dcf61a777387307071ea97d954aa *R/wtpolyap.R
102bd55bba8f8b4ea8c0e7c76a2ffb8d *inst/doc/Makefile
30f2193ca2dbb76222b568e54fe03ba1 *build/vignette.rds
6821e81a4d0275f699002ea4158cacca *inst/doc/pp1.R
134ca7abd4d89854e6f9a5e4c4e57ff5 *inst/doc/pp1.Rnw
60cf84f029be4a5325c1528e9e60e3ec *inst/doc/pp1.pdf
806f3ce1d990b0032ff600dbc273a15c *inst/doc/pp1.tex
4388f62ae698c61d4700c06f5e555ecc *inst/doc/ref.bib
3b716132aa2bd8685f02914ffd67b2c1 *man/constrppmn.Rd
bfe800f8e58196f92238b7c95ea743a1 *man/constrppprob.Rd
5b6324e86f7901e956c84d1c78909919 *man/feasible.Rd
Expand All @@ -27,3 +26,5 @@ f3306aed9f43d4ce80ac07816b69a2ed *man/wtpolyap.Rd
acc74c55459b9a9eeec62c095169c1cb *src/cwpolya.c
d067003129a24718720d6524880cdf08 *src/means.c
3210d9b6a13447a22754e5819e7cb2dc *src/probvect.c
134ca7abd4d89854e6f9a5e4c4e57ff5 *vignettes/pp1.Rnw
4388f62ae698c61d4700c06f5e555ecc *vignettes/ref.bib
Binary file added build/vignette.rds
Binary file not shown.
14 changes: 0 additions & 14 deletions inst/doc/Makefile

This file was deleted.

148 changes: 148 additions & 0 deletions inst/doc/pp1.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
### R code from vignette source 'pp1.Rnw'
### Encoding: UTF-8

###################################################
### code chunk number 1: expp1
###################################################
set.seed(313)
library(polyapost)
ysamp<-c(0,1)
K<-10-2
polyap(ysamp,K)


###################################################
### code chunk number 2: expp2
###################################################
y<-rgamma(500,5)
mean(y)
samp<-sample(1:500,25)
ysamp<-y[samp]
mean(ysamp)
K<-500-25
simmns<-rep(0,10)
for(i in 1:10){simmns[i]<-mean(polyap(ysamp,K))}
round(simmns,digits=2)


###################################################
### code chunk number 3: expp3
###################################################
x<-sort(rgamma(500,10))
y<-rnorm(500,20 + 2*x,3)
cor(x,y)
mean(y)
mnx<-mean(x)
mnx


###################################################
### code chunk number 4: exp3.2
###################################################
samp<-sort(c(sample(1:250,8),sample(251:500,17)))
ysamp<-y[samp]
xsamp<-x[samp]
mean(ysamp)
mean(xsamp)
A1<-rbind(rep(1,25),c(rep(1,8),rep(0,17)))
b1<-c(1,0.5)
A2<-rbind(xsamp,-diag(25))
b2<-c(10.0,rep(0,25))
A3<-matrix(xsamp,1,25)
b3<-9.7


###################################################
### code chunk number 5: exp3.4
###################################################
eps<-0.001
initsol<-feasible(A1,A2,A3,b1,b2,b3,eps)
initsol[c(3,9,25)]


###################################################
### code chunk number 6: exp3.6
###################################################
burnin<-1
reps<-200001
out<-constrppmn(A1,A2,A3,b1,b2,b3,initsol,reps,ysamp,burnin)
mean(out[[1]])


###################################################
### code chunk number 7: figstrat
###################################################
plot(out[[1]][seq(1,200001,by=200)])
#plot(out[[1]])


###################################################
### code chunk number 8: exp3.7
###################################################
out[[2]]
out[[3]]


###################################################
### code chunk number 9: exp3.8
###################################################
A1<-rbind(rep(1,25))
A2<--diag(25)
b1<-1
b2<-rep(0,25)
initsol<-rep(0.04,25)
reps<-1000001
out<-constrppmn(A1,A2,NULL,b1,b2,NULL,initsol,reps,ysamp,burnin)
mean(out[[1]])
subseq<-seq(1,1000001,by=1000)
mean(out[[1]][subseq])
sqrt(var(out[[1]][subseq]))


###################################################
### code chunk number 10: figcprs
###################################################
plot(out[[1]][subseq])
#plot(out[[1]])


###################################################
### code chunk number 11: exp3.9
###################################################
K<-500-25
simmns<-rep(0,1000)
for(i in 1:1000){
simmns[i]<-mean(polyap(ysamp,K))
}
mean(simmns)
sqrt(var(simmns))


###################################################
### code chunk number 12: fig:prs
###################################################
plot(simmns)


###################################################
### code chunk number 13: exp4
###################################################
A1<-rbind(rep(1,6),1:6)
A2<-rbind(c(2,5,7,1,10,8),diag(-1,6))
A3<-matrix(c(1,1,1,0,0,0),1,6)
b1<-c(1,3.5)
b2<-c(6,rep(0,6))
b3<-0.45
initsol<-rep(1/6,6)
out<-constrppprob(A1,A2,A3,b1,b2,b3,initsol,2000,5)
round(out,digits=5)


###################################################
### code chunk number 14: exp5
###################################################
ysamp<-c(1,2,3)
wts<-c(1,2,3)
wtpolyap(ysamp,wts,25)


0 comments on commit a5d6962

Please sign in to comment.