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

st: non linear least squares function

From   Jennifer Alix <>
Subject   st: non linear least squares function
Date   Thu, 28 Aug 2003 13:11:21 -0700


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

Does that make sense?  Has anybody encountered a similar problem
before?  Any hints, suggestions, references, useful prayers to the Stata


*   For searches and help try:

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