File: inter_probs.Rd

package info (click to toggle)
r-cran-conting 1.7-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 472 kB
  • sloc: makefile: 2
file content (94 lines) | stat: -rwxr-xr-x 2,726 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
\name{inter_probs}
\alias{inter_probs}

\title{
Calculate Posterior Probability of Each Term
}
\description{
This function computes the posterior probability of each 
term using the MCMC output of \code{"bcct"} and \code{"bict"} objects. 
}
\usage{
inter_probs(object, cutoff = 0.75, n.burnin = 0, thin = 1)
}

\arguments{
  \item{object}{
An object of class \code{"bcct"} or \code{"bict"}.
}
  \item{cutoff}{
An optional argument giving the cutoff posterior probability for displaying posterior 
summary statistics of the log-linear parameters. Only those log-linear parameters with 
a posterior probability greater than \code{cutoff} will be returned as part of the output. 
The default value is 0.75.
}
  \item{n.burnin}{
An optional argument giving the number of iterations to use as burn-in. 
The default value is 0.
}
  \item{thin}{
An optional argument giving the amount of thinning to use, i.e. the computations are 
based on every \code{thin}-th value in the MCMC sample. The default value is 1, i.e. no
thinning.
}
}
\details{
This function provides a scaled back version of what \code{\link{inter_stats}} provides.

The use of thinning is recommended when the number of MCMC iterations and/or the number of 
log-linear parameters in the maximal model are/is large, which may cause problems with 
comuter memory storage.
}
\value{
This function returns an object of class \code{"interprob"} which is a list with the 
following components. 

\item{term}{A vector of term labels.}

\item{prob}{A vector of posterior probabilities.}

\item{thin}{The value of the argument \code{thin}.}

The function will only return elements in the above list if \code{prob} > \code{cutoff}.

}

\author{
Antony M. Overstall \email{A.M.Overstall@soton.ac.uk}.
}

\seealso{
\code{\link{bcct}},
\code{\link{bict}},
\code{\link{print.interprob}},
\code{\link{inter_stats}}.
}
\examples{
set.seed(1)
## Set seed for reproducibility
data(AOH)
## Load AOH data

test1<-bcct(formula=y~(alc+hyp+obe)^3,data=AOH,n.sample=100,prior="UIP")
## Starting from maximal model of saturated model do 100 iterations of MCMC
## algorithm.

inter_probs(test1,n.burnin=10,cutoff=0)
## Calculate posterior probabilities having used a burn-in phase of 
## 10 iterations and a cutoff of 0 (i.e. display all terms with 
## non-zero posterior probability). Will get the following:

#Posterior probabilities of log-linear parameters:
#            post_prob
#(Intercept)    1.0000
#alc            1.0000
#hyp            1.0000
#obe            1.0000
#alc:hyp        0.1778
#alc:obe        0.0000
#hyp:obe        0.4444
#alc:hyp:obe    0.0000

## Note that the MCMC chain (after burn-in) does not visit any models 
## with the alc:obe or alc:hyp:obe interactions.
}