I have categorical data represented by a two-way contingency table (say $Y_{1}$ and $Y_{2}$, each with three levels). The data consists of fully observed counts (where data on both $Y_{1}$ and $Y_{2}$ are available) and partially observed counts in three margins (where data on only $Y_{1}$ or only $Y_{2}$ or both $Y_{1}$ and $Y_{2}$ are missing). I fit a certain log-linear model to the given dataset. How do I generate bootstrap samples from the above model fitted to the data in R?
$\begingroup$
$\endgroup$
4
-
$\begingroup$ Could you post the data or something that approximates the data? I could help write R code for bootstrapping, but I'm not sure what "partially observed counts in three margins" refers to—you just have some missing data for $Y_1$ and $Y_2$? How are you handling those NAs right now? Also, what is the code for the log-linear model? $\endgroup$– Mark WhiteCommented Jun 10, 2017 at 4:59
-
$\begingroup$ I don't know how to include a contingency table in a question or a comment on this website. Can you tell me the procedure so that I can show you the data ? $\endgroup$– user143487Commented Jun 12, 2017 at 10:13
-
$\begingroup$ I am fitting the log-linear models using the 'ecm.cat' function included in the 'cat' package in R. It can handle such incomplete tables with missing data (using iterative algorithms). The table of fitted counts is produced as the output apart from some other trivial quantities. $\endgroup$– user143487Commented Jun 12, 2017 at 10:39
-
$\begingroup$ The log-linear model includes the main effects (overall effect and those due to each variable and due to each missing indicator) and two-way interaction terms (between the variables, between the missing indicators and some terms between the variables and their missing indicators (depending on the model)). The logarithm of the expected counts is expressed as a sum of the above terms in a log-linear model. $\endgroup$– user143487Commented Jun 12, 2017 at 10:51
Add a comment
|