Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Number of observations for marginal means r(_N)

From   Ada Keding <>
To   statalist <>
Subject   st: Number of observations for marginal means r(_N)
Date   Mon, 10 Jun 2013 15:32:38 +0100

Dear all,

I am having trouble extracting the number of observations on which
estimates for group means at different time points (visits) are based
in a mixed model.

My data is saved in long format, and the model looks something like this:

          xtmixed outcome i.arm i.visit i.arm##i.visit i.covariate ||
id:visit, cov(un) reml

I then extract marginal means with 'margins'

          margins arm##visit, atmeans

This gives means and confidence intervals for the outcome of each arm
at each visit, but not the number of associated observations. As far
as I gather, these are saved as r(_N).
When I call up the matrix for r(_N)...

          matrix list r(_N)

... it gives the same number of observations for each margin however,
which is a large value that bears no resemblance to the number of IDs
in the data set. How can I extract the particular number of IDs used
at each margin?

Any pointers are much appreciated.

Many thanks,


Ada Keding
University of York
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index