Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Running glm with user-written link function in a program without a separate ado file?


From   Aspen Chen <[email protected]>
To   [email protected]
Subject   st: Running glm with user-written link function in a program without a separate ado file?
Date   Fri, 31 Jan 2014 09:12:55 -0600

Dear fellow Stata users,

I have been writing a program (an ado file) that runs a glm estimate
with a user-written link function. The program can run successfully
when the link function is stored as a separate ado file. But I would
like to keep the entire program as one single ado file for simplicity
sake if possible. Does someone know if there is a way to accomplish
it?

If it helps illustrate the issue, here is an outline of what I've
tried so far to no avail. First, I kept the link function as a
subroutine in the main program as below, but the glm failed to find
the link function.

program main_program
[...]
glm [...], l(mylink) [...]
end

program mylink
[...]
end

I then thought perhaps rewriting the glm as another subroutine would
help it find the link function. This approach has worked at times but
not consistently (not exactly sure why).

program main_program
[...]
myglm [varlist]
end

program mylink
[...]
end

program myglm
syntax varlist
glm `varlist', l(mylink) [...]
end


Thanks for going through my question. Any input is appreciated.

Regards,
Aspen

----
Aspen Chen
Doctoral Candidate
Department of Sociology
University of Connecticut
[email protected]
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index