extRC {extRC} | R Documentation |
Extended RC model
Description
Main function that fits extended RC models based on different types of aggregation (continuation, local, global) and different divergence functions defined by a suitable value of lambda.
Usage
extRC(N, mod, k, la, marg.cons = c("free","equal","shift"))
Arguments
N |
observed contingency table |
mod |
vector indicating the types of aggregation for row and column variables ("c" for continuation, "l" for local, "g" for global) |
k |
rank required for the matrix of interaction parameters |
la |
value of lambda parameter |
marg.cons |
type of constraint on the marginal distributions |
Value
la |
vector of lambda values (when a vector is in input) |
dev |
deviance of the fitted model (when only one lambda value is in input) or vector of deviances (when a vector of lambda values is in input) |
df |
degrees of freedom (when only one lambda value is in input) |
it |
number of iterations (when only one lambda value is in input) |
dis |
final discrepancy (when only one lambda value is in input) |
pj |
vector of joint probabilities under the fitted model (when only one lambda value is in input) |
eta |
full vector of marginal parameters (when only one lambda value is in input) |
etaX |
vector of row marginal parameters (when only one lambda value is in input) |
etaY |
vector of column marginal parameters (whenonly one lambda value is in input) |
Eta |
matrix of association parameters (when only one lambda value is in input) |
la |
vector of lambda values (when more lambda values are in input) |
dev |
vector of deviance values (when more lambda values are in input) |
Author(s)
Francesco Bartolucci, Antonio Forcina
Examples
# load data
data(mobility)
# for a single value of lambda, fit model with constraints of rank 1 on
# local-local logits and without constraints on the marginal distributions
out = extRC(mobility,mod=c("l","l"),k=1,la=0.6)
summary(out)
# for a single value of lambda, fit model with constraints of rank 1 on
# local-local logits and under constrain of equal marginal distributions
out = extRC(mobility,mod=c("l","l"),k=1,la=0.6,marg.cons="equal")
summary(out)
# for a single value of lambda, fit model with constraints of rank 2 on
# global-global logits and under constraint that marginal distributions
# are equal up to a constant shift
out = extRC(mobility,mod=c("g","g"),k=2,la=0.6,marg.cons="shift")
summary(out)
# fit model for a vector of lambdas
la = seq(-1.8,0.6,length.out=10)
out1 = extRC(mobility,mod=c("l","l"),k=1,la=la)
plot(out1)