Hello,
I am having a lot of trouble programming a (what I perceive as) complicated
function to use with the nl command. I can make the command work for
simple functions, but alas, life is not simple.
I have data on individuals within communities, and would like to program
the function:
sum over i (norm(BXi)*F(BZ1i) + (1-norm(BXi)*F(BZ2i))
where X are variables which determine an individual's probability of being
in a certain group and Z1 and Z2 are individual and community
characteristics that determine the behaviors of these groups. F() is just
some linear function of the Z's. The dependent variable is a
community-level observation, so this thing is sort of like an integral over
all of the individuals in the community. The main problem is, the number
of individuals i varies from community to community, from 10 to
62. Therefore, it seems like I need to build a different function for each
community.
Does that make sense? Has anybody encountered a similar problem
before? Any hints, suggestions, references, useful prayers to the Stata
deity?
Thanks,
Jennifer
*
* 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/