Description Usage Arguments Value Author(s) Examples
Evaluate all possible models
1 2 3 4 | exhaustive(modelData,
modelPrior = c("flat", "exponential", "independent", "dependent", "dep.linear"),
modelConfigs = NULL, algorithm = c("2", "1"),
computation = getComputation(), order = FALSE)
|
modelData |
the data necessary for model estimation,
which is the result from |
modelPrior |
either “flat” (default),
“exponential”, “independent”,
“dependent”, or “dep.linear”, see
|
modelConfigs |
optional matrix of model
configurations, which are then evaluated instead of all
possible configurations. It is check for coherency with
|
algorithm |
either “2” (default, fast for small dimension of spline coefficients) or “1” (fast for small number of observations), specifying the algorithm version. Only matters for normal models, for GLMs always a type 2 algorithm is used. |
computation |
computation options produced by
|
order |
should the models be ordered after their
posterior probability? (default: |
a list with the data frame “models” comprising the model configurations, (R2 for normal models) / log marginal likelihoods / log priors / posteriors; and the inclusion probabilities matrix “inclusionProbs”.
Daniel Sabanes Bove daniel.sabanesbove@ifspm.uzh.ch
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 | ## get some data
attach(longley)
## get model data
md <- modelData(y=Employed,
X=cbind(GNP, Armed.Forces))
## get a list of all possible models with this data
res <- exhaustive(md)
res
## now the same, but with cubic splines and algorithm 1:
## get model data
md <- modelData(y=Employed,
X=cbind(GNP, Armed.Forces),
splineType="cubic")
## get a list of all possible models with this data
res <- exhaustive(md,
algorithm="1")
res
## now only compute for two certain model configurations:
configs <- cbind(GNP=c(1L, 3L),
Armed.Forces=c(2L, 3L))
res <- exhaustive(md,
modelConfigs=configs)
## now for generalised response:
## get the model data
md <- glmModelData(y=as.numeric(Employed > 64),
X=cbind(GNP, Armed.Forces),
family=binomial)
## and do the exhaustive search
res <- exhaustive(md,
modelPrior="dependent",
computation=
getComputation(higherOrderCorrection=FALSE,
debug=FALSE))
res$models <- res$models[order(res$models$post, decreasing=TRUE), ]
res
res1 <- exhaustive(md,
computation=
getComputation(higherOrderCorrection=FALSE,
debug=FALSE))
res2 <- exhaustive(md,
computation=
getComputation(higherOrderCorrection=FALSE,
debug=FALSE))
res3 <- exhaustive(md,
computation=
getComputation(higherOrderCorrection=FALSE,
debug=TRUE))
str(res1)
identical(res1, res2)
identical(res1, res3)
## now with offsets:
set.seed(93)
offsets <- rnorm(n=length(Employed))
md <- glmModelData(y=round(Employed / 10),
X=cbind(GNP, Armed.Forces),
family=poisson,
offsets=offsets)
res <- exhaustive(md,
computation=
getComputation(higherOrderCorrection=TRUE,
debug=TRUE))
res
res <- exhaustive(md,
computation=
getComputation(higherOrderCorrection=TRUE,
debug=TRUE))
res
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.