Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: solving equations with stata


From   "Michael Blasnik" <michael.blasnik@verizon.net>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: solving equations with stata
Date   Wed, 04 Jan 2006 11:51:56 -0500

gen weight=res^-2
sum weight, meanonly
replace weight=weight*_N/r(sum)

Michael Blasnik
michael.blasnik@verizon.net


----- Original Message ----- From: "Gianfranco Spiteri" <Gianfranco.Spiteri@hpa.org.uk>
To: <statalist@hsphsun2.harvard.edu>
Sent: Wednesday, January 04, 2006 11:34 AM
Subject: st: solving equations with stata



Hi,
I am trying to perform a downweighting process for a dataset I am working on
(for an outbreak detection system of infectious diseases based on the
Farrington method). As part of the process I have got to a point were I have
a list of residuals (res). I need to create weights for the original data
based on these residuals using the following formulas:
weight = a * res ^ -2
where a is a constant such that:
sum of all weights = n

where n is the number of observations (n is 35 or less with this method)
I'm sure there is a relatively straight forward way of doing this in stata,
but I cant seem to find it. Can anyone help me out,
thanks
Gianfranco
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index