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

st: matrix not positive definite

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

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

Does anybody has an idea?


-----Original Message-----
[] On Behalf Of n j cox
Sent: 19 May, 2008 4:21 PM
Subject: Re: Re: st: Creating a new variable with information from other

Your question is an FAQ:

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

         4/03    Is there a way to tell Stata to try all values of a
                 particular variable in a foreach statement without
                 specifying them?

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


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:

*   For searches and help try:

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