Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • meglm

    Hello All,

    I have two datasets, one with a binary outcome and the second with a count outcome.
    I have difficulty importing the two datasets to Stata because each dataset has different sheets in excel, and also, two different numbers of observations for each dataset.

    Can I use this code for two different datasets? and how?

    HTML Code:
    meglm thk prethk cc##tv || school: || class:, family(Poisson) link(logit)

  • #2
    As you do not provide example data for either data set, nobody can say whether that code can be used for either one, let alone for both.

    To the more general question that perhaps you were trying to ask, namely, whether you can use a Poisson regression in the analysis of a dichotomous ("binary") outcome, the answer is yes. It works best if the 1 outcome is pretty rare, but it's acceptable even otherwise.

    If, however, you were thinking of combining the two data sets into a single data set, I would not do that. Mixing two different kinds of data usually leads to data management problems and uninterpretable analyses.

    The other thing that occurs to me, is that perhaps your data set with the dichotomous outcome has individual level observations, whereas the other data set with the count outcome aggregates up to some higher level (class?) and gives the outcome as the total number of 1 responses for all students in the class? If so, then what you would be best off doing is aggregating up the data set with the dichotomous outcome to the same level of aggregation as the count outcome data set, appending them together (if otherwise appropriate), and then running a single analysis. Of course, if the data have been aggregated to the class level, then having a random effect at the class: level makes no sense and usually leads to non-convergence of the estimates.

    Look, there are many possiblities that are consistent with your data description. That's why we ask people not to describe their data but to show it using the -dataex- command. So, if after reading this reply you want further assistance, be sure to use -dataex- to show example data from each data set when you post back. If you are running version 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    When asking for help with code, always show example data. When showing example data, always use -dataex-.

    Comment

    Working...
    X