Description Usage Arguments Value References See Also Examples
Given a vector of joint probabilities, the generalized marginal interactions (gmi) associated to a hierarchical family of marginal sets are computed. If the input is a matrix, gmi are computed for every column.
1 |
freq |
Matrix of joint probabilities. Every column describes a joint pdf. |
marg |
A character vector decribing the marginal sets and the logits used to build the interactions. See |
lev |
Number of categories of the categorical variables. See the help of |
names |
Names of the categorical variables |
mflag |
The symbol used to denote variables that are marginalized, default "M". See |
A list with two components: marginals and gmi; marginals is a legend that explains the interactions, gmi is a vector or a matrix that contains the interactions.
Colombi R, Giordano S, Cazzaro M (2014) hmmm: An R Package for hierarchical multinomial marginal models. Journal of Statistical Software, 59(11), 1-25, URL http://www.jstatsoft.org/v59/i11/.
inv_GMI
, hmmm.model
, marg.list
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # joint frequencies for two ordinal variables
# H: level of happiness on a scale from 1 to 5
# S: level of satisfaction on a scale from 1 to 5
y<-c(50,36,15,15,13,15,84,60,42,
35,6,26,105,113,57,5,26,62,
465,334,4,10,34,186,1404)
lev<-c(5,5)
marg<-c("g-m","m-g","g-g")
names<-c("H","S")
o<-GMI(cbind(c(y),c(y/sum(y))),marg,lev,names,mflag="m")
o
|
$marginals
inter. inter.names marg. marg.names type npar start end
[1,] 1 H 1 H g 4 1 4
[2,] 2 S 2 S g 4 5 8
[3,] 12 H.S 12 H,S gg 16 9 24
$gmi
F1 F2
H1 3.66420247 3.66420247
H2 2.41782036 2.41782036
H3 1.59972547 1.59972547
H4 0.30464554 0.30464554
S1 3.17059716 3.17059716
S2 2.05060508 2.05060508
S3 1.32571624 1.32571624
S4 0.04622934 0.04622934
H.S1 4.16197692 4.16197692
H.S2 3.49409418 3.49409418
H.S3 3.08000071 3.08000071
H.S4 2.57542899 2.57542899
H.S5 3.70775573 3.70775573
H.S6 3.60657951 3.60657951
H.S7 3.12647200 3.12647200
H.S8 2.43156384 2.43156384
H.S9 3.49927129 3.49927129
H.S10 3.27096538 3.27096538
H.S11 3.19703544 3.19703544
H.S12 2.47232787 2.47232787
H.S13 3.03803704 3.03803704
H.S14 3.08466683 3.08466683
H.S15 2.71554840 2.71554840
H.S16 2.73279837 2.73279837
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.