Description Usage Arguments Details Value Author(s) References See Also Examples
These functions compute tests based on sienaBayesFit
objects
resulting from sienaBayes
.
Print and plot methods are available for the results of the
multi-parameter test.
1 2 3 4 5 6 7 | simpleBayesTest(z, nfirst=z$nwarm+1, tested0=0,
probs = c(0.025,0.975), ndigits=4)
multipleBayesTest(z, testedPar, nfirst=z$nwarm+1, tested0=0, ndigits=4)
## S3 method for class 'multipleBayesTest'
print(x, descriptives=FALSE, ...)
## S3 method for class 'multipleBayesTest'
plot(x, xlim=NULL, ylim=NULL, main=NULL, ...)
|
z |
A |
nfirst |
The first element of the MCMC chain used for calculating properties of the chain; this can be the first element for which it is assumed that convergence has occurred. |
tested0 |
The value to be tested; for |
probs |
A vector of two numbers between 0 and 1, the credibility limits for the credibility intervals. |
ndigits |
Number of digits to be given when representing the limits of the credibility intervals. |
testedPar |
A vector with the numbers of the parameters
to be tested (numbered as in the output of |
x |
A |
... |
Extra arguments for |
descriptives |
Boolean: whether to print the posterior mean, s.d., and covariance matrix of the parameters included in the test. |
xlim |
Parameter |
ylim |
Parameter |
main |
Parameter |
Note that for the default values of probs
and tested0
,
simpleBayesTest
gives information also contained in
print.sienaBayesFit
.
To use multipleBayesTest
, it is advisable first to execute
simpleBayesTest
to see the numbers that index the testedPar
parameter; or its columns, if it is a matrix.
multipleBayesTest
tests the hypothesis that the multivariate parameter
for the effects defined by testedPar
is equal to tested0
.
If testedPar
is a set or vector of numbers then the parameters
with these numbers are tested; if testedPar
is a k * p
matrix,
the tested hypothesis is for the k
linear combinations defined by its
rows, and the number of columns p
should be equal to the number of
non-rate effects, which is the same as the number of effects listed by
simpleBayesTest
.
For the test, distances (for one parameter) or Mahalanobis distances
(for more than one parameter) of the elements
of the posterior sample from the posterior mean are calculated,
and the p
-value is the relative frequency that these are greater than the
distance between the tested value and the posterior mean.
The p
-values reported by simpleBayesTest
are one-sided, and those
reported by multipleBayesTest
are two-sided for k=1
,
and 'all-sided' if k
is larger than 1.
The plot presents a density plot of the posterior Mahalanobis distances,
and the observed distance is indicated by a vertical line (if within
the plot window).
simpleBayesTest
produces a data frame containing for the non-rate
effects their names,
an indication of whether or not they are varying parameters,
and test results.
For each parameter separately, (for the varying parameters) the population
mean or (for the non-varying parameters) the value is tested.
The test results are the posterior credibility intervals for the
probability limits defined by probs
,
and the posterior probabilities of values larger than tested0
.
multipleBayesTest
produces an object of type multipleBayesTest
which is a list with values:
prob |
posterior |
chisquared |
test statistic |
postDistances |
sample from posterior of distances from |
nullValue |
input value of |
effectNames |
names of effects tested as given in ... |
posteriorSample |
sample from posterior of tested effects |
print.multipleBayesTest
prints the posterior p
-value with an
explanation; and the proportions of all sign patterns
(of deviations from 0) in the sample from the posterior.
plot.multipleBayesTest
plots the density function of
x$postDistances
.
Tom Snijders
See the manual and http://www.stats.ox.ac.uk/~snijders/siena/
sienaBayes
, print.sienaBayesFit
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 | Group1 <- sienaDependent(array(c(N3401, HN3401), dim=c(45, 45, 2)))
Group3 <- sienaDependent(array(c(N3403, HN3403), dim=c(37, 37, 2)))
Group4 <- sienaDependent(array(c(N3404, HN3404), dim=c(33, 33, 2)))
Group6 <- sienaDependent(array(c(N3406, HN3406), dim=c(36, 36, 2)))
dataset.1 <- sienaDataCreate(Friends = Group1)
dataset.3 <- sienaDataCreate(Friends = Group3)
dataset.4 <- sienaDataCreate(Friends = Group4)
dataset.6 <- sienaDataCreate(Friends = Group6)
FourGroups <- sienaGroupCreate(
list(dataset.1, dataset.3, dataset.4, dataset.6))
FourEffects <- getEffects(FourGroups)
FourEffects <- includeEffects(FourEffects, transTrip)
FourEffects <- setEffect(FourEffects, density, random=TRUE)
FourEffects <- setEffect(FourEffects, recip, random=TRUE)
print(FourEffects, includeRandoms=TRUE)
# Note this also shows the "randomEffects" column.
FourAlgo <- sienaAlgorithmCreate(projname = "FourGroups", maxlike=TRUE)
## Not run:
bayes.model <- sienaBayes(FourAlgo, data = FourGroups,
effects = FourEffects, nwarm=10, nmain=25, nrunMHBatches=10)
bayes.model
simpleBayesTest(bayes.model, probs = c(0.05,0.95))
(mbt <- multipleBayesTest(bayes.model, c(2,3)))
(mbt2 <- multipleBayesTest(bayes.model, c(2,3), tested0 = c(2,0.6)))
plot(mbt)
plot(mbt2)
plot(mbt$posteriorSample)
# Possible because the number of tested parameters is 2.
A <- matrix(c(1,1,0),1,3)
multipleBayesTest(bayes.model, A)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.