Announcement

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

  • Multiple regression and multivariate ordered logistic regression commands

    Hello Stata users,

    I am going to run multivariate ordered logistic regression and multiple regression. My question pertains to independent variables (indicators).

    Some of them may be binary, ordinal, and continuous.

    How am I going to differentiate them while writing commands for stata?

    ologit 1contin 2contin 1binary 1ordinal

    Please help

    Thank you
    Last edited by Witold Orlik; 11 Nov 2018, 06:15.

  • #2
    If my question was not clear enough please let me know, thank you for any help

    Comment


    • #3
      You can optionally prefix continuous variables with c. For discrete variables, whether dichotomous or polytomous, the i. prefix is necessary. There is no particular way to designate a variable as ordinal, nor do Stata commands offer any special treatment for ordinal predictor variables: you can either treat them is discrete or continuous, depending on which approach is more congenial to your context, data, and modeling assumptions. Thus:

      Code:
      ologit c.contin1  c.contin2 i.binary3 i.ordinal // OR c.ordinal, DEPENDING
      I have changed your variable names to put the digit at the end, because Stata variable names are not allowed to begin with a digit, only a letter or underscore character is permitted there.

      Comment


      • #4
        Thank you Clyde,

        Tow more issues, please - how to 'write' interaction between two variables in multiple and ordered regression? I suppose it is the same for both..

        Should the dependent variable be set in command as first?

        Thanks everybody willing to answer

        Best wishes

        Witold
        Last edited by Witold Orlik; 12 Nov 2018, 08:15.

        Comment


        • #5
          In Stata regression commands, the dependent variable always is listed first. Interactions are best handled using the ## operator. So If I want to do a regression with z as the dependent variable, and I want to include as predictors variables x (continuous) and y (discrete) and their interaction, the code is:

          Code:
          regress z c.x##i.y
          Note that the c. prefix here is not optional. In interactions, unlike the non-interaction context, variables listed with no prefix are interpreted as discrete by default. Rather than trying to remember these conflicting default options, the safer coding practice is to always specify c. or i. prefixes on all variables (except the dependent variable) in any regression command.

          Before you proceed with work on your specific project, I think you would benefit from familiarizing yourself with the general principles of Stata syntax that apply to nearly all Stata commands, as well as the basic commands that are part of everyday data management and analysis in Stata. Thee is PDF documentation that comes installed with Stata. You can access it from the Help menu. Read the [GS] Getting Started and [U] User's Guide parts. It's going to take you some time to get through it all, but your investment in that will be rapidly repaid by being able to work more efficiently in Stata.

          Comment

          Working...
          X