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: function evaluator program error
From
Carlotta Schuster <[email protected]>
To
statalist <[email protected]>
Subject
st: function evaluator program error
Date
Tue, 5 Mar 2013 14:21:47 +0100
Dear Statalisters,
I have a problem creating a function evaluator program. I have
followed step by step the syntax offered in the help files but I keep
getting the following error when trying to estimate my model:
nlweight returned 198
verify that nlweight is a function evaluator program
My program is the following:
capture program drop nlweight
program nlweight
version 11
syntax varlist(min=1 max=180) if, at(name)
local assetsinstock : word 1 of `varlist'
local age_1 : word 2 of `varlist'
local s2009 : word 3 of `varlist'
local age_2 : word 4 of `varlist'
local s2008 : word 5 of `varlist'
local age_3 : word 6 of `varlist'
local s2007 : word 7 of `varlist'
local age_4 : word 8 of `varlist'
local s2006 : word 9 of `varlist'
local age_5 : word 10 of `varlist'
local s2005 : word 11 of `varlist'
local age_6 : word 12 of `varlist'
local s2004 : word 13 of `varlist'
local age_7 : word 14 of `varlist'
local s2003 : word 15 of `varlist'
local age_8 : word 16 of `varlist'
local s2002 : word 17 of `varlist'
local age_9 : word 18 of `varlist'
local s2001 : word 19 of `varlist'
local age_10 : word 20 of `varlist'
local s2000 : word 21 of `varlist'
local age_11 : word 22 of `varlist'
local s1999 : word 23 of `varlist'
local age_12 : word 24 of `varlist'
local s1998 : word 25 of `varlist'
local age_13 : word 26 of `varlist'
local s1997 : word 27 of `varlist'
local age_14 : word 28 of `varlist'
local s1996 : word 29 of `varlist'
local age_15 : word 30 of `varlist'
local s1995 : word 31 of `varlist'
local age_16 : word 32 of `varlist'
local s1994 : word 33 of `varlist'
local age_17 : word 34 of `varlist'
local s1993 : word 35 of `varlist'
local age_18 : word 36 of `varlist'
local s1992 : word 37 of `varlist'
local age_19 : word 38 of `varlist'
local s1991 : word 39 of `varlist'
local age_20 : word 40 of `varlist'
local s1990 : word 41 of `varlist'
local age_21 : word 42 of `varlist'
local s1989 : word 43 of `varlist'
local age_22 : word 44 of `varlist'
local s1988 : word 45 of `varlist'
local age_23 : word 46 of `varlist'
local s1987 : word 47 of `varlist'
local age_24 : word 48 of `varlist'
local s1986 : word 49 of `varlist'
local age_25 : word 50 of `varlist'
local s1985 : word 51 of `varlist'
local age_26 : word 52 of `varlist'
local s1984 : word 53 of `varlist'
local age_27 : word 54 of `varlist'
local s1983 : word 55 of `varlist'
local age_28 : word 56 of `varlist'
local s1982 : word 57 of `varlist'
local age_29 : word 58 of `varlist'
local s1981 : word 59 of `varlist'
local age_30 : word 60 of `varlist'
local s1980 : word 61 of `varlist'
local age_31 : word 62 of `varlist'
local s1979 : word 63 of `varlist'
local age_32 : word 64 of `varlist'
local s1978 : word 65 of `varlist'
local age_33 : word 66 of `varlist'
local s1977 : word 67 of `varlist'
local age_34 : word 68 of `varlist'
local s1976 : word 69 of `varlist'
local age_35 : word 70 of `varlist'
local s1975 : word 71 of `varlist'
local age_36 : word 72 of `varlist'
local s1974 : word 73 of `varlist'
local age_37 : word 74 of `varlist'
local s1973 : word 75 of `varlist'
local age_38 : word 76 of `varlist'
local s1972 : word 77 of `varlist'
local age_39 : word 78 of `varlist'
local s1971 : word 79 of `varlist'
local age_40 : word 80 of `varlist'
local s1970 : word 81 of `varlist'
local age_41 : word 82 of `varlist'
local s1969 : word 83 of `varlist'
local age_42 : word 84 of `varlist'
local s1968 : word 85 of `varlist'
local age_43 : word 86 of `varlist'
local s1967 : word 87 of `varlist'
local age_44 : word 88 of `varlist'
local s1966 : word 89 of `varlist'
local age_45 : word 90 of `varlist'
local s1965 : word 91 of `varlist'
local age_46 : word 92 of `varlist'
local s1964 : word 93 of `varlist'
local age_47 : word 94 of `varlist'
local s1963 : word 95 of `varlist'
local age_48 : word 96 of `varlist'
local s1962 : word 97 of `varlist'
local age_49 : word 98 of `varlist'
local s1961 : word 99 of `varlist'
local age_50 : word 100 of `varlist'
local s1960 : word 101 of `varlist'
local age_51 : word 102 of `varlist'
local s1959 : word 103 of `varlist'
local age_52 : word 104 of `varlist'
local s1958 : word 105 of `varlist'
local age_53 : word 106 of `varlist'
local s1957 : word 107 of `varlist'
local age_54 : word 108 of `varlist'
local s1956 : word 109 of `varlist'
local age_55 : word 110 of `varlist'
local s1955 : word 111 of `varlist'
local age_56 : word 112 of `varlist'
local s1954 : word 113 of `varlist'
local age_57 : word 114 of `varlist'
local s1953 : word 115 of `varlist'
local age_58 : word 116 of `varlist'
local s1952 : word 117 of `varlist'
local age_59 : word 118 of `varlist'
local s1951 : word 119 of `varlist'
local age_60 : word 120 of `varlist'
local s1950 : word 121 of `varlist'
local age_61 : word 122 of `varlist'
local s1949 : word 123 of `varlist'
local age_62 : word 124 of `varlist'
local s1948 : word 125 of `varlist'
local age_63 : word 126 of `varlist'
local s1947 : word 127 of `varlist'
local age_64 : word 128 of `varlist'
local s1946 : word 129 of `varlist'
local age_65 : word 130 of `varlist'
local s1945 : word 131 of `varlist'
local age_66 : word 132 of `varlist'
local s1944 : word 133 of `varlist'
local age_67 : word 134 of `varlist'
local s1943 : word 135 of `varlist'
local age_68 : word 136 of `varlist'
local s1942 : word 137 of `varlist'
local age_69 : word 138 of `varlist'
local s1941 : word 139 of `varlist'
local age_70 : word 140 of `varlist'
local s1940 : word 141 of `varlist'
local age_71 : word 142 of `varlist'
local s1939 : word 143 of `varlist'
local age_72 : word 144 of `varlist'
local s1938 : word 145 of `varlist'
local age_73 : word 146 of `varlist'
local s1937 : word 147 of `varlist'
local age_74 : word 148 of `varlist'
local s1936 : word 149 of `varlist'
local age_75 : word 150 of `varlist'
local s1935 : word 151 of `varlist'
local age_76 : word 152 of `varlist'
local s1934 : word 153 of `varlist'
local age_77 : word 154 of `varlist'
local s1933 : word 155 of `varlist'
local age_78 : word 156 of `varlist'
local s1932 : word 157 of `varlist'
local age_79 : word 158 of `varlist'
local s1931 : word 159 of `varlist'
local age_80 : word 160 of `varlist'
local s1930 : word 161 of `varlist'
local logincome : word 162 of `varlist'
local logincomesq : word 163 of `varlist'
local children : word 164 of `varlist'
local childrensq : word 165 of `varlist'
local logliquidassets : word 166 of `varlist'
local logliquidassetssq : word 167 of `varlist'
local retired : word 168 of `varlist'
local college : word 169 of `varlist'
local highschool : word 170 of `varlist'
local age : word 171 of `varlist'
local agesq : word 172 of `varlist'
local married : word 173 of `varlist'
local financial_sector : word 174 of `varlist'
local SMC_pc : word 175 of `varlist'
local GPD_pc : word 176 of `varlist'
local GDP_pc : word 177 of `varlist'
local INF : word 178 of `varlist'
local UNEMP : word 179 of `varlist'
local PENS : word 180 of `varlist'
tempname A B lambda beta1 beta2 beta3 beta4 beta5
beta6 beta7 beta8 beta9 beta10 beta11 beta12 beta13 beta14 beta15
beta16 beta17 beta18 beta19
scalar `A' = `at'[1,1]
scalar `B' = `at'[1,2]
scalar `lambda' = `at'[1,3]
scalar `beta1' = `at'[1,4]
scalar `beta2' = `at'[1,5]
scalar `beta3' = `at'[1,6]
scalar `beta4' = `at'[1,7]
scalar `beta5' = `at'[1,8]
scalar `beta6' = `at'[1,9]
scalar `beta7' = `at'[1,10]
scalar `beta8' = `at'[1,11]
scalar `beta9' = `at'[1,12]
scalar `beta10' = `at'[1,13]
scalar `beta11' = `at'[1,14]
scalar `beta12' = `at'[1,15]
scalar `beta13' = `at'[1,16]
scalar `beta14' = `at'[1,17]
scalar `beta15' = `at'[1,18]
scalar `beta16' = `at'[1,19]
scalar `beta17' = `at'[1,20]
scalar `beta18' = `at'[1,21]
scalar `beta19' = `at'[1,22]
replace `assetsinstock' = `A' +
`B'*((`age_1'^`lambda'*`stockreturn2009'+`age_2'^`lambda'*`stockreturn2008'+`age_3'^`lambda'*`stockreturn2007'+`age_4'^`lambda'*`stockreturn2006'+`age_5'^`lambda'*`stockreturn2005'+`age_6'^`lambda'*`stockreturn2004'+`age_7'^`lambda'*`stockreturn2003'+`age_8'^`lambda'*`stockreturn2002'+`age_9'^`lambda'*`stockreturn2001'+`age_10'^`lambda'*`stockreturn2000'+`age_11'^`lambda'*`stockreturn1999'+`age_12'^`lambda'*`stockreturn1998'+`age_13'^`lambda'*`stockreturn1997'+`age_14'^`lambda'*`stockreturn1996'+`age_15'^`lambda'*`stockreturn1995'+`age_16'^`lambda'*`stockreturn1994'+`age_17'^`lambda'*`stockreturn1993'+`age_18'^`lambda'*`stockreturn1992'+`age_19'^`lambda'*`stockreturn1991'+`age_20'^`lambda'*`stockreturn1990'+`age_21'^`lambda'*`stockreturn1989'+`age_22'^`lambda'*`stockreturn1988'+`age_23'^`lambda'*`stockreturn1987'+`age_24'^`lambda'*`stockreturn1986'+`age_25'^`lambda'*`stockreturn1985'+`age_26'^`lambda'*`stockreturn1984'+`age_27'^`lambda'*`stockreturn1983'+`age_28'^`lambda'*`s!
tockreturn1982'+`age_29'^`lambda'*`stockreturn1981'+`age_30'^`lambda'*`stockreturn1980'+`age_31'^`lambda'*`stockreturn1979'+`age_32'^`lambda'*`stockreturn1978'+`age_33'^`lambda'*`stockreturn1977'+`age_34'^`lambda'*`stockreturn1976'+`age_35'^`lambda'*`stockreturn1975'+`age_36'^`lambda'*`stockreturn1974'+`age_37'^`lambda'*`stockreturn1973'+`age_38'^`lambda'*`stockreturn1972'+`age_39'^`lambda'*`stockreturn1971'+`age_40'^`lambda'*`stockreturn1970'+`age_41'^`lambda'*`stockreturn1969'+`age_42'^`lambda'*`stockreturn1968'+`age_43'^`lambda'*`stockreturn1967'+`age_44'^`lambda'*`stockreturn1966'+`age_45'^`lambda'*`stockreturn1965'+`age_46'^`lambda'*`stockreturn1964'+`age_47'^`lambda'*`stockreturn1963'+`age_48'^`lambda'*`stockreturn1962'+`age_49'^`lambda'*`stockreturn1961'+`age_50'^`lambda'*`stockreturn1960'+`age_51'^`lambda'*`stockreturn1959'+`age_52'^`lambda'*`stockreturn1958'+`age_53'^`lambda'*`stockreturn1957'+`age_54'^`lambda'*`stockreturn1956'+`age_55'^`lambda'*`stockreturn1955'+!
`age_56'^`lambda'*`stockreturn1954'+`age_57'^`lambda'*`stockreturn1953
'+`age_58'^`lambda'*`stockreturn1952'+`age_59'^`lambda'*`stockreturn1951'+`age_60'^`lambda'*`stockreturn1950'+`age_61'^`lambda'*`stockreturn1949'+`age_62'^`lambda'*`stockreturn1948'+`age_63'^`lambda'*`stockreturn1947'+`age_64'^`lambda'*`stockreturn1946'+`age_65'^`lambda'*`stockreturn1945'+`age_66'^`lambda'*`stockreturn1944'+`age_67'^`lambda'*`stockreturn1943'+`age_68'^`lambda'*`stockreturn1942'+`age_69'^`lambda'*`stockreturn1941'+`age_70'^`lambda'*`stockreturn1940'+`age_71'^`lambda'*`stockreturn1939'+`age_72'^`lambda'*`stockreturn1938'+`age_73'^`lambda'*`stockreturn1937'+`age_74'^`lambda'*`stockreturn1936'+`age_75'^`lambda'*`stockreturn1935'+`age_76'^`lambda'*`stockreturn1934'+`age_77'^`lambda'*`stockreturn1933'+`age_78'^`lambda'*`stockreturn1932'+`age_79'^`lambda'*`stockreturn1931'+`age_80'^`lambda'*`stockreturn1930')/(`age_1'^`lambda'+`age_2'^`lambda'+`age_3'^`lambda'+`age_4'^`lambda'+`age_5'^`lambda'+`age_6'^`lambda'+`age_7'^`lambda'+`age_8'^`lambda'+`age_9'^`lambda'+`age!
_10'^`lambda'+`age_11'^`lambda'+`age_12'^`lambda'+`age_13'^`lambda'+`age_14'^`lambda'+`age_15'^`lambda'+`age_16'^`lambda'+`age_17'^`lambda'+`age_18'^`lambda'+`age_19'^`lambda'+`age_20'^`lambda'+`age_21'^`lambda'+`age_22'^`lambda'+`age_23'^`lambda'+`age_24'^`lambda'+`age_25'^`lambda'+`age_26'^`lambda'+`age_27'^`lambda'+`age_28'^`lambda'+`age_29'^`lambda'+`age_30'^`lambda'+`age_31'^`lambda'+`age_32'^`lambda'+`age_33'^`lambda'+`age_34'^`lambda'+`age_35'^`lambda'+`age_36'^`lambda'+`age_37'^`lambda'+`age_38'^`lambda'+`age_39'^`lambda'+`age_40'^`lambda'+`age_41'^`lambda'+`age_42'^`lambda'+`age_43'^`lambda'+`age_44'^`lambda'+`age_45'^`lambda'+`age_46'^`lambda'+`age_47'^`lambda'+`age_48'^`lambda'+`age_49'^`lambda'+`age_50'^`lambda'+`age_51'^`lambda'+`age_52'^`lambda'+`age_53'^`lambda'+`age_54'^`lambda'+`age_55'^`lambda'+`age_56'^`lambda'+`age_57'^`lambda'+`age_58'^`lambda'+`age_59'^`lambda'+`age_60'^`lambda'+`age_61'^`lambda'+`age_62'^`lambda'+`age_63'^`lambda'+`age_64'^`lambda'+`a!
ge_65'^`lambda'+`age_66'^`lambda'+`age_67'^`lambda'+`age_68'^`lambda'+
`age_69'^`lambda'+`age_70'^`lambda'+`age_71'^`lambda'+`age_72'^`lambda'+`age_73'^`lambda'+`age_74'^`lambda'+`age_75'^`lambda'+`age_76'^`lambda'+`age_77'^`lambda'+`age_78'^`lambda'+`age_79'^`lambda'+`age_80'^`lambda'))+`beta1'*`logincome'+`beta2'*`logincomesq'+`beta3'*`children'+`beta4'*`childrensq'+`beta5'*`logliquidassets'+`beta6'*`logliquidassetssq'+`beta7'*`retired'+`beta8'*`college'+`beta9'*`highschool'+`beta10'*`age'+`beta11'*`agesq'+`beta12'*`married'+`beta13'*`financial_sector'+`beta14'*`SMC_pc'+`beta15'*`GPD_pc'+`beta16'*`GDP_pc'+`beta17'*`INF'+`beta18'*`UNEMP'+`beta19'*`PENS'
`if'
end
Then I run:
nl weight @ assetsinstock age_1 stockreturn2009 age_2 stockreturn2008
age_3 stockreturn2007 age_4 stockreturn2006 age_5 stockreturn2005
age_6 stockreturn2004 age_7 stockreturn2003 age_8 stockreturn2002
age_9 stockreturn2001 age_10 stockreturn2000 age_11 stockreturn1999
age_12 stockreturn1998 age_13 stockreturn1997 age_14 stockreturn1996
age_15 stockreturn1995 age_16 stockreturn1994 age_17 stockreturn1993
age_18 stockreturn1992 age_19 stockreturn1991 age_20 stockreturn1990
age_21 stockreturn1989 age_22 stockreturn1988 age_23 stockreturn1987
age_24 stockreturn1986 age_25 stockreturn1985 age_26 stockreturn1984
age_27 stockreturn1983 age_28 stockreturn1982 age_29 stockreturn1981
age_30 stockreturn1980 age_31 stockreturn1979 age_32 stockreturn1978
age_33 stockreturn1977 age_34 stockreturn1976 age_35 stockreturn1975
age_36 stockreturn1974 age_37 stockreturn1973 age_38 stockreturn1972
age_39 stockreturn1971 age_40 stockreturn1970 age_41 stockreturn1969
age_42 stockreturn1968 age_43 stockreturn1967 age_44 stockreturn1966
age_45 stockreturn1965 age_46 stockreturn1964 age_47 stockreturn1963
age_48 stockreturn1962 age_49 stockreturn1961 age_50 stockreturn1960
age_51 stockreturn1959 age_52 stockreturn1958 age_53 stockreturn1957
age_54 stockreturn1956 age_55 stockreturn1955 age_56 stockreturn1954
age_57 stockreturn1953 age_58 stockreturn1952 age_59 stockreturn1951
age_60 stockreturn1950 age_61 stockreturn1949 age_62 stockreturn1948
age_63 stockreturn1947 age_64 stockreturn1946 age_65 stockreturn1945
age_66 stockreturn1944 age_67 stockreturn1943 age_68 stockreturn1942
age_69 stockreturn1941 age_70 stockreturn1940 age_71 stockreturn1939
age_72 stockreturn1938 age_73 stockreturn1937 age_74 stockreturn1936
age_75 stockreturn1935 age_76 stockreturn1934 age_77 stockreturn1933
age_78 stockreturn1932 age_79 stockreturn1931 age_80 stockreturn1930
logincome logincomesq children childrensq logliquidassets
logliquidassetssq retired college highschool age agesq married
financial_sector SMC_pc GPD_pc GDP_pc INF UNEMP PENS, parameters(A B
lambda beta1 beta2 beta3 beta4 beta5 beta6 beta7 beta8 beta9 beta10
beta11 beta12 beta13 beta14 beta15 beta16 beta17 beta18 beta19)
initial(A 1 B 4 lambda 7 beta1 1 beta2 1 beta3 1 beta4 1 beta5 1 beta6
1 beta7 1 beta8 1 beta9 1 beta10 1 beta11 1 beta12 1 beta13 1 beta14 1
beta15 1 beta16 1 beta17 1 beta18 1 beta19 1)
And I get the error message. Any help will be appreciated. Thanks.
Best,
Carlotta
*
* 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/