Announcement

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

  • Fixed Covariates

    Hi, I am an undergraduate student attempting repeat measure multilevel modelling for my dissertation and would really appreciate help in producing the code for my project!

    I am studying protein intake of high school students and seeing whether breakfast, lunch or dinner provides the most protein. I'm planning on doing this through regression using the overall daily protein intake.

    I have collected their intake over two 24 hour periods (therefore have repeated measures data.)
    My fixed explanatory variables are mealtimes (breakfast, lunch, dinner) and my levels are level 2 (day of observation (either first or second 24hr period)), level 3 ( Pupil Number) and level 4 (School).
    My fixed covariates are sociodemographic variables such as age, gender however I'm struggling to understand how I fit these into the model

    Currently i'm doing:
    xtmixed TotalProtein_ Breakfast_ Lunch_ Dinner_ || Sch: || PupilN: || DayObs:

    but i don't know how to account for my fixed covariates- any help would be VERY appreciated.


  • #2
    Abby:
    welcome to this forum.
    I would try:
    Code:
    xtmixed TotalProtein_ Breakfast_ Lunch_ Dinner_ c.age##c.age i.gender|| Sch: || PupilN: || DayObs:
    I would check whether -age- shows evidence of non-linear relationship with the regressand.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thank you so much! I really appreciate your guidance. If I wanted to add Ethnicity and Socioeconomic deprivation as additional fixed covariates, would I include it with c.Ethnicity##c.ethnicity or i.ethnicity?

      With thanks,
      Abby

      Comment


      • #4
        Just a side note, after Carlo's helpful reply: if you have the latest versions of Stata (at least from Stata 14 onwards), you are supposed to use - mixed - instead.

        With regards to the notation, "c." of for continuous variables and "i." is for categorical variables.
        Best regards,

        Marcos

        Comment


        • #5
          Abby:
          if, as I suspect, -ethnicity- is a categorical variable (and, if so, as Marcos promptly remind you about, needs an -i.-, not a -c.-), -i.ethnicity- is the way to go.
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            Thank you all so much, I really appreciate your guidance.

            In regards to testing the non-linear relationship between fixed covariates such as gender, ethnicity - would that be through simple regression for age, but for the categorical variables of gender, ethnicity and socioeconomic deprivation Spearman's rank correlation would be more suitable?

            Comment


            • #7
              Abby:
              -estat vce- seems the way to here.
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment

              Working...
              X