Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: matrix not positive definite


From   Orsetta.CAUSA@oecd.org
To   statalist@hsphsun2.harvard.edu
Subject   st: matrix not positive definite
Date   Tue, 27 May 2008 12:31:19 +0200

Dear statlist,

I am running a very "big" cross-country regression on micro data on students
scores. Students have pweights. Standard errors are clustered by schools.
I am introducing country fixed effects, interactions between country fixed
effects and individual and school level variables, and then letting some
individual parameters be common across countries but vary according to
country level variables (of course in this case I cannot control for these
country variables otherwise they would be collinear to the country fixed
effects).
For some variables this did work, for others, but with the same specification
and coding (I am looping on them), the program tells me "matrix not positive
definite".

I cannot sort out the origin of this problem and why does it appear from some
variables only.

Does anybody has an idea?
Thanks


orsetta 

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of n j cox
Sent: 19 May, 2008 4:21 PM
To: statalist@hsphsun2.harvard.edu
Subject: Re: Re: st: Creating a new variable with information from other
observations

.
Your question is an FAQ:

FAQ     . . . . . . . . . . Making foreach go through all values of a 
variable

         4/03    Is there a way to tell Stata to try all values of a
                 particular variable in a foreach statement without
                 specifying them?
                 http://www.stata.com/support/faqs/data/foreach.html

Note that -search foreach- would have pointed you to this FAQ.

Nick
n.j.cox@durham.ac.uk

Davide Cantoni

Wonderful, that is just what I was looking for. Thank you, Maarten and Even.

Even Bergseng

 > Can -levelsof- help you?

Davide Cantoni

 >>:: is there a way to run a "foreach" over all (numeric) values that a
 >>given variable takes, without having to specify exactly the values
 >>that this variable takes? Ok, I see, in most cases this would be a job
 >>for "by(sort)", but I cannot help thinking that there are some cases
 >>in which bysort does not help me -- for example when I want to run
 >>more than one command, as I would do within the braces of
 >>"foreach...", or when the units the loop runs over (the `X' in
 >>"foreach X", so to speak) are used in some logical condition.
 >>
 >>In brief: is there a way to create a numlist from the unique values
 >>that a variable takes? Or how would you proceed?

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


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index