Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Simple mean imputation
From
Austin Nichols <[email protected]>
To
[email protected]
Subject
Re: st: Simple mean imputation
Date
Fri, 17 Aug 2012 13:19:43 -0400
Ona McCarthy <[email protected]> :
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 <[email protected]> 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/