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: mm_root arguments limitation issue


From   "Tharyan, Rajesh" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: mm_root arguments limitation issue
Date   Sat, 30 Jul 2011 10:26:03 +0100

Hi all

I am trying to run a program  like below,  using Ben Jann's  mm_root function within the moremata program.

ssc install moremata
clear all
sysuse auto,clear
gen y=price/24
gen z= mpg/12
g x =.
mata
v=J(1,1,.)
st_view(v,.,"x  price mpg rep78 trunk weight length turn displacement y z headroom") function y(x,a,b,c,d,e,f,g,h,i,j,k) { return ((-1*(a-b)*(1+x)^5) + ((c-(b*x))*(1+x)^4) + ((d-(e*x))*(1+x)^3) + ((f-(g*x))*(1+x)^2) + ((h-(i*x))*(1+x)) + ((j-(k*x))) + ((j-(k*x))/x)) } for (i=1;i<=rows(v);i++) { r=mm_root(x=.,&y(),0,1,0,1000,v[i,2],
v[i,3],v[i,4],v[i,5],v[i,6],v[i,7],
v[i,8],v[i,9],v[i,10],v[i,11],v[i,12])
v[i,1]=x
}
end
l in 1/10, noo

I get the following error
               mm_root():  3001  expected 4 to 16 arguments but received 17
                 <istmt>:     -  function returned error r(3001);

a look at the help file  seems to suggest that  the number of  additional arguments to pass on to function f is  limited to 10. 

Q1. Could  there any particular reason why it is limited to 10? 
Q2. Is there a way to increase the number of options?
Q3. Setting the
           lo:  real scalar containing lower endpoint of the search interval
           up:  real scalar containing upper endpoint of the search interval to 0 and 1 leads to a large number of zeros and 1. cross checking with Excel solver  shows that in such cases the  answer is actually different. Is there a best way to set lo and up values? 

Thanks very much for your time

regards
Rajesh





*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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