Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Simple mean imputation


From   Austin Nichols <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Simple mean imputation
Date   Fri, 17 Aug 2012 13:19:43 -0400

Ona McCarthy <omccarthy@tccr.org.uk> :

egen m=rowmean(PAM1-PAM20)
replace m=m*20
egen miss=rowmiss(PAM1-PAM20)
replace m=. if miss>2


On Fri, Aug 17, 2012 at 1:09 PM, Ona McCarthy <omccarthy@tccr.org.uk> wrote:
> Hello,
>
> A measure we are using consists of 20 items, the scoring of which is
> simply a sum of all the items. It is not to be scored if more than 2
> items are missing but if 1 or 2 items are missing, it calls for simple
> mean imputation (I know this is an old method but the measure was
> created in 1988). It's not the overall dataset mean that's imputed, but
> the mean of the 18 or 19 items for each observation.
>
> My attempt is this:
>
> foreach var of varlist PAM1-PAM20 {
> if var >=. missingcount = missingcount + 1 } if missingcount <3,
> generate impflag=1, else impflag = 0
>
> but I'm now stuck. I know this is very basic but I can't figure it out.
> I'd appreciate any help,
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index