# st: linear algebra, partial sums

 From Austin Frakt To statalist@hsphsun2.harvard.edu Subject st: linear algebra, partial sums Date Fri, 30 Nov 2007 14:12:25 -0500

I am a long-time Stata user but have just encountered a problem I don't know how to solve (efficiently) in Stata. I'm not at all averse to reading manuals, FAQs and the like but I am not sure where to start on this one. So I'm looking for ideas on how to get going in the right direction.

I have data organized in precisely the way I need it so any rearrangement to solve my problem will have to be undone. However, one variable, call it X, has a lot of missing values, and I need to impute those. I happen to have a lot of partial sums of X (over subsets of observations). It turns out I have more independent partial sums of X than I have missing values. So I can compute missing values of X exactly (in a least-squares sense).

My question is, how might I go about setting up and computing this linear algebra problem with minimal headache in rearranging my data. I would love to do this in Stata though I could export to Matlab if necessary (I hope not!). Let me be clear, I know the linear algebra well so no need to advise on that. I do not know if there are some tricks out there for setting it up and solving it in Stata. That's what I'd like advice on. For instance, it would be wonderful if I didn't need to rearrange my data. Or, if rearrangement is necessary, it would be wonderful if there were routines available (e.g., from SCC or otherwise) that handled the rearranging and its undoing. Anybody solved a problem like this?

--
Austin Frakt, PhD
Health Systems Research Scientist

Health Care Financing and Economics
VA Boston Healthcare System

*
* 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/