Description Usage Arguments Value Author(s) See Also Examples
inla.group
group or cluster covariates so to reduce
the number of unique values
1 | inla.group(x, n = 25, method = c("cut", "quantile"), idx.only = FALSE)
|
x |
The vector of covariates to group. |
n |
Number of classes or bins to group into. |
method |
Group either using bins with equal length intervals
( |
idx.only |
Option to return the index only and not the
|
inla.group
return the new grouped covariates where the classes
are set to the median of all the covariates belonging to that group.
Havard Rue hrue@math.ntnu.no
1 2 3 4 5 6 7 8 9 10 | ## this gives groups 3 and 8
x = 1:10
x.group = inla.group(x, n = 2)
## this is the intended use, to reduce the number of unique values in
## the of first argument of f()
n = 100
x = rnorm(n)
y = x + rnorm(n)
result = inla(y ~ f(inla.group(x, n = 20), model = "iid"), data=data.frame(y=y,x=x))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.