Dear Statalist,

I am trying to estimate a 15 goods QUAIDS model with 5 household demographics characteristics. I am getting this error message: nlsurquaids returned 103 verify that nlsurquaids is a function evaluator program


Here is the code:
Code:
cap program drop nlsur quaids

program quaids

    version 13

    syntax varlist(min=63 max=63) if, at(name)
    tokenize `varlist'
    args w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13 w14 lnp1 lnp2 lnp3 lnp4 lnp5 lnp6 lnp7 lnp8 lnp9 lnp10 lnp11 lnp12 lnp13 lnp14 lnp15 lnm cdf1 cdf2 cdf3 cdf4 cdf5 cdf6 cdf7 cdf8 cdf9 cdf10 cdf11 cdf12 cdf13 cdf14 x1 x2 x3 x4 x5 pdf1 pdf2 pdf3 pdf4 pdf5 pdf6 pdf7 pdf8 pdf9 pdf10 pdf11 pdf12 pdf13 pdf14

    tempname a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15
    scalar `a0'=`at'[1,1]
    scalar `a1'=`at'[1,2]
    scalar `a2'=`at'[1,3]
    scalar `a3'=`at'[1,4]
    scalar `a4'=`at'[1,5]
    scalar `a5'=`at'[1,6]
    scalar `a6'=`at'[1,7]
    scalar `a7'=`at'[1,8]
    scalar `a8'=`at'[1,9]
    scalar `a9'=`at'[1,10]
    scalar `a10'=`at'[1,11]
    scalar `a11'=`at'[1,12]
    scalar `a12'=`at'[1,13]
    scalar `a13'=`at'[1,14]
    scalar `a14'=`at'[1,15]
    scalar `a15'=1-`a1'-`a2'-`a3'-`a4'-`a5'-`a6'-`a7'-`a8'-`a9'-`a10'-`a11'-`a12'-`a13'-`a14'

    tempname b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 b12 b13 b14
    scalar `b1'=`at'[1,16]
    scalar `b2'=`at'[1,17]
    scalar `b3'=`at'[1,18]
    scalar `b4'=`at'[1,19]
    scalar `b5'=`at'[1,20]
    scalar `b6'=`at'[1,21]
    scalar `b7'=`at'[1,22]
    scalar `b8'=`at'[1,23]
    scalar `b9'=`at'[1,24]
    scalar `b10'=`at'[1,25]
    scalar `b11'=`at'[1,26]
    scalar `b12'=`at'[1,27]
    scalar `b13'=`at'[1,28]
    scalar `b14'=`at'[1,29]
    
    tempname h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14
    scalar `h1'=`at'[1,30]
    scalar `h2'=`at'[1,31]
    scalar `h3'=`at'[1,32]    
    scalar `h4'=`at'[1,33]
    scalar `h5'=`at'[1,34]
    scalar `h6'=`at'[1,35]
    scalar `h7'=`at'[1,36]
    scalar `h8'=`at'[1,37]
    scalar `h9'=`at'[1,38]
    scalar `h10'=`at'[1,39]
    scalar `h11'=`at'[1,40]
    scalar `h12'=`at'[1,41]
    scalar `h13'=`at'[1,42]
    scalar `h14'=`at'[1,43]

    tempname y11 y12 y13 y14 y15 y16 y17 y18 y19 y110 y111 y112 y113 y114 y115
    tempname y21 y22 y23 y24 y25 y26 y27 y28 y29 y210 y211 y212 y213 y214 y215
    tempname y31 y32 y33 y34 y35 y36 y37 y38 y39 y310 y311 y312 y313 y314 y315
    tempname y41 y42 y43 y44 y45 y46 y47 y48 y49 y410 y411 y412 y413 y414 y415
    tempname y51 y52 y53 y54 y55 y56 y57 y58 y59 y510 y511 y512 y513 y514 y515
    tempname y61 y62 y63 y64 y65 y66 y67 y68 y69 y610 y611 y612 y613 y614 y615
    tempname y71 y72 y73 y74 y75 y76 y77 y78 y79 y710 y711 y712 y713 y714 y715
    tempname y81 y82 y83 y84 y85 y86 y87 y88 y89 y810 y811 y812 y813 y814 y815
    tempname y91 y92 y93 y94 y95 y96 y97 y98 y99 y910 y911 y912 y913 y914 y915
    tempname y101 y102 y103 y104 y105 y106 y107 y108 y109 y1010 y1011 y1012 y1013 y1014 y1015
    tempname y111 y112 y113 y114 y115 y116 y117 y118 y119 y1110 y1111 y1112 y1113 y1114 y1115
    tempname y121 y122 y123 y124 y125 y126 y127 y128 y129 y1210 y1211 y1212 y1213 y1214 y1215
    tempname y131 y132 y133 y134 y135 y136 y137 y138 y139 y1310 y1311 y1312 y1313 y1314 y1315
    tempname y141 y142 y143 y144 y145 y146 y147 y148 y149 y1410 y1411 y1412 y1413 y1414 y1415
    tempname y151 y152 y153 y154 y155 y156 y157 y158 y159 y1510 y1511 y1512 y1513 y1514 y1515

    scalar `y11'=`at'[1,44]
    scalar `y12'=`at'[1,45]
    scalar `y13'=`at'[1,46]
    scalar `y14'=`at'[1,47]
    scalar `y15'=`at'[1,48]
    scalar `y16'=`at'[1,49]
    scalar `y17'=`at'[1,50]
    scalar `y18'=`at'[1,51]
    scalar `y19'=`at'[1,52]
    scalar `y110'=`at'[1,53]
    scalar `y111'=`at'[1,54]
    scalar `y112'=`at'[1,55]
    scalar `y113'=`at'[1,56]
    scalar `y114'=`at'[1,57]
    scalar `y115'=-`y11'-`y12'-`y13'-`y14'-`y15'-`y16'-`y17'-`y18'-`y19'-`y110'-`y111'-`y112'-`y113'-`y114'

    scalar `y21'=`y12'
    scalar `y22'=`at'[1,58]
    scalar `y23'=`at'[1,59]
    scalar `y24'=`at'[1,60]
    scalar `y25'=`at'[1,61]
    scalar `y26'=`at'[1,62]
    scalar `y27'=`at'[1,63]
    scalar `y28'=`at'[1,64]
    scalar `y29'=`at'[1,65]
    scalar `y210'=`at'[1,66]
    scalar `y211'=`at'[1,67]
    scalar `y212'=`at'[1,68]
    scalar `y213'=`at'[1,69]
    scalar `y214'=`at'[1,70]
    scalar `y215'=-`y21'-`y22'-`y23'-`y24'-`y25'-`y26'-`y27'-`y28'-`y29'-`y210'-`y211'-`y212'-`y213'-`y214'

    scalar `y31'=`y13'
    scalar `y32'=`y23'
    scalar `y33'=`at'[1,71]
    scalar `y34'=`at'[1,72]
    scalar `y35'=`at'[1,73]
    scalar `y36'=`at'[1,74]
    scalar `y37'=`at'[1,75]
    scalar `y38'=`at'[1,76]
    scalar `y39'=`at'[1,77]
    scalar `y310'=`at'[1,78]
    scalar `y311'=`at'[1,79]
    scalar `y312'=`at'[1,80]
    scalar `y313'=`at'[1,81]
    scalar `y314'=`at'[1,82]
    scalar `y315'=-`y31'-`y32'-`y33'-`y34'-`y35'-`y36'-`y37'-`y38'-`y39'-`y310'-`y311'-`y312'-`y313'-`y314'

    scalar `y41'=`y14'
    scalar `y42'=`y24'
    scalar `y43'=`y34'
    scalar `y44'=`at'[1,83]
    scalar `y45'=`at'[1,84]
    scalar `y46'=`at'[1,85]
    scalar `y47'=`at'[1,86]
    scalar `y48'=`at'[1,87]
    scalar `y49'=`at'[1,88]
    scalar `y410'=`at'[1,89]
    scalar `y411'=`at'[1,90]
    scalar `y412'=`at'[1,91]
    scalar `y413'=`at'[1,92]
    scalar `y414'=`at'[1,93]
    scalar `y415'=-`y41'-`y42'-`y43'-`y44'-`y45'-`y46'-`y47'-`y48'-`y49'-`y410'-`y411'-`y412'-`y413'-`y414'
    
    scalar `y51'=`y15'
    scalar `y52'=`y25'
    scalar `y53'=`y35'
    scalar `y54'=`y45'
    scalar `y55'=`at'[1,94]
    scalar `y56'=`at'[1,95]
    scalar `y57'=`at'[1,96]
    scalar `y58'=`at'[1,97]
    scalar `y59'=`at'[1,98]
    scalar `y510'=`at'[1,99]
    scalar `y511'=`at'[1,100]
    scalar `y512'=`at'[1,101]
    scalar `y513'=`at'[1,102]
    scalar `y514'=`at'[1,103]
    scalar `y515'=-`y51'-`y52'-`y53'-`y54'-`y55'-`y56'-`y57'-`y58'-`y59'-`y510'-`y511'-`y512'-`y513'-`y514'

    scalar `y61'=`y16'
    scalar `y62'=`y26'
    scalar `y63'=`y36'
    scalar `y64'=`y46'
    scalar `y65'=`y56'
    scalar `y66'=`at'[1,104]
    scalar `y67'=`at'[1,105]
    scalar `y68'=`at'[1,106]
    scalar `y69'=`at'[1,107]
    scalar `y610'=`at'[1,108]
    scalar `y611'=`at'[1,109]
    scalar `y612'=`at'[1,110]
    scalar `y613'=`at'[1,111]
    scalar `y614'=`at'[1,112]
    scalar `y615'=-`y61'-`y62'-`y63'-`y64'-`y65'-`y66'-`y67'-`y68'-`y69'-`y610'-`y611'-`y612'-`y613'-`y614'
    
    scalar `y71'=`y17'
    scalar `y72'=`y27'
    scalar `y73'=`y37'
    scalar `y74'=`y47'
    scalar `y75'=`y57'
    scalar `y76'=`y67'
    scalar `y77'=`at'[1,113]
    scalar `y78'=`at'[1,114]
    scalar `y79'=`at'[1,115]
    scalar `y710'=`at'[1,116]
    scalar `y711'=`at'[1,117]
    scalar `y712'=`at'[1,118]
    scalar `y713'=`at'[1,119]
    scalar `y714'=`at'[1,120]
    scalar `y715'=-`y71'-`y72'-`y73'-`y74'-`y75'-`y76'-`y77'-`y78'-`y79'-`y710'-`y711'-`y712'-`y713'-`y714'
    
    scalar `y81'=`y18'
    scalar `y82'=`y28'
    scalar `y83'=`y38'
    scalar `y84'=`y48'
    scalar `y85'=`y58'
    scalar `y86'=`y68'
    scalar `y87'=`y78'
    scalar `y88'=`at'[1,121]
    scalar `y89'=`at'[1,122]
    scalar `y810'=`at'[1,123]
    scalar `y811'=`at'[1,124]
    scalar `y812'=`at'[1,125]
    scalar `y813'=`at'[1,126]
    scalar `y814'=`at'[1,127]
    scalar `y815'=-`y81'-`y82'-`y83'-`y84'-`y85'-`y86'-`y87'-`y88'-`y89'-`y810'-`y811'-`y812'-`y813'-`y814'
    
    scalar `y91'=`y19'
    scalar `y92'=`y29'
    scalar `y93'=`y39'
    scalar `y94'=`y49'
    scalar `y95'=`y59'
    scalar `y96'=`y69'
    scalar `y97'=`y79'
    scalar `y98'=`y89'
    scalar `y99'=`at'[1,128]
    scalar `y910'=`at'[1,129]
    scalar `y911'=`at'[1,130]
    scalar `y912'=`at'[1,131]
    scalar `y913'=`at'[1,132]
    scalar `y914'=`at'[1,133]
    scalar `y915'=-`y91'-`y92'-`y93'-`y94'-`y95'-`y96'-`y97'-`y98'-`y99'-`y910'-`y911'-`y912'-`y913'-`y914'
    
    scalar `y101'=`y110'
    scalar `y102'=`y210'
    scalar `y103'=`y310'
    scalar `y104'=`y410'
    scalar `y105'=`y510'
    scalar `y106'=`y610'
    scalar `y107'=`y710'
    scalar `y108'=`y810'
    scalar `y109'=`y910'
    scalar `y1010'=`at'[1,134]
    scalar `y1011'=`at'[1,135]
    scalar `y1012'=`at'[1,136]
    scalar `y1013'=`at'[1,137]
    scalar `y1014'=`at'[1,138]
    scalar `y1015'=-`y101'-`y102'-`y103'-`y104'-`y105'-`y106'-`y107'-`y108'-`y109'-`y1010'-`y1011'-`y1012'-`y1013'-`y1014'
    
    scalar `y111'=`y111'
    scalar `y112'=`y211'
    scalar `y113'=`y311'
    scalar `y114'=`y411'
    scalar `y115'=`y511'
    scalar `y116'=`y611'
    scalar `y117'=`y711'
    scalar `y118'=`y811'
    scalar `y119'=`y911'
    scalar `y1110'=`y1011'
    scalar `y1111'=`at'[1,139]
    scalar `y1112'=`at'[1,140]
    scalar `y1113'=`at'[1,141]
    scalar `y1114'=`at'[1,142]
    scalar `y1115'=-`y111'-`y112'-`y113'-`y114'-`y115'-`y116'-`y117'-`y118'-`y119'-`y1110'-`y1111'-`y1112'-`y1113'-`y1114'
    
    scalar `y121'=`y112'
    scalar `y122'=`y212'
    scalar `y123'=`y312'
    scalar `y124'=`y412'
    scalar `y125'=`y512'
    scalar `y126'=`y612'
    scalar `y127'=`y712'
    scalar `y128'=`y812'
    scalar `y129'=`y912'
    scalar `y1210'=`y1012'
    scalar `y1211'=`y1112'
    scalar `y1212'=`at'[1,143]
    scalar `y1213'=`at'[1,144]
    scalar `y1214'=`at'[1,145]
    scalar `y1215'=-`y121'-`y122'-`y123'-`y124'-`y125'-`y126'-`y127'-`y128'-`y129'-`y1210'-`y1211'-`y1212'-`y1213'-`y1214'
    
    scalar `y131'=`y113'
    scalar `y132'=`y213'
    scalar `y133'=`y313'
    scalar `y134'=`y413'
    scalar `y135'=`y513'
    scalar `y136'=`y613'
    scalar `y137'=`y713'
    scalar `y138'=`y813'
    scalar `y139'=`y913'
    scalar `y1310'=`y1013'
    scalar `y1311'=`y1113'
    scalar `y1312'=`y1213'
    scalar `y1313'=`at'[1,146]
    scalar `y1314'=`at'[1,147]
    scalar `y1315'=-`y131'-`y132'-`y133'-`y134'-`y135'-`y136'-`y137'-`y138'-`y139'-`y1310'-`y1311'-`y1312'-`y1313'-`y1314'
    
    scalar `y141'=`y114'
    scalar `y142'=`y214'
    scalar `y143'=`y314'
    scalar `y144'=`y414'
    scalar `y145'=`y514'
    scalar `y146'=`y614'
    scalar `y147'=`y714'
    scalar `y148'=`y814'
    scalar `y149'=`y914'
    scalar `y1410'=`y1014'
    scalar `y1411'=`y1114'
    scalar `y1412'=`y1214'
    scalar `y1413'=`y1314'
    scalar `y1414'=`at'[1,148]
    scalar `y1415'=-`y141'-`y142'-`y143'-`y144'-`y145'-`y146'-`y147'-`y148'-`y149'-`y1410'-`y1411'-`y1412'-`y1413'-`y1414'
    
    scalar `y151'=`y115'
    scalar `y152'=`y215'
    scalar `y153'=`y315'
    scalar `y154'=`y415'
    scalar `y155'=`y515'
    scalar `y156'=`y615'
    scalar `y157'=`y715'
    scalar `y158'=`y815'
    scalar `y159'=`y915'
    scalar `y1510'=`y1015'
    scalar `y1511'=`y1115'
    scalar `y1512'=`y1215'
    scalar `y1513'=`y1315'
    scalar `y1514'=`y1415'
    scalar `y1515'=-`y151'-`y152'-`y153'-`y154'-`y155'-`y156'-`y157'-`y158'-`y159'-`y1510'-`y1511'-`y1512'-`y1513'-`y1514'
    
    tempname r11 r12 r13 r14 r15            
    tempname r21 r22 r23 r24 r25
    tempname r31 r32 r33 r34 r35
    tempname r41 r42 r43 r44 r45
    tempname r51 r52 r53 r54 r55
    tempname r61 r62 r63 r64 r65
    tempname r71 r72 r73 r74 r75
    tempname r81 r82 r83 r84 r85
    tempname r91 r92 r93 r94 r95
    tempname r101 r102 r103 r104 r105
    tempname r111 r112 r113 r114 r115
    tempname r121 r122 r123 r124 r125
    tempname r131 r132 r133 r134 r135
    tempname r141 r142 r143 r144 r145
    
    scalar `r11'=`at'[1,149]
    scalar `r12'=`at'[1,150]
    scalar `r13'=`at'[1,151]    
    scalar `r14'=`at'[1,152]
    scalar `r15'=`at'[1,153]
    
    scalar `r21'=`at'[1,154]
    scalar `r22'=`at'[1,155]
    scalar `r23'=`at'[1,156]    
    scalar `r24'=`at'[1,157]
    scalar `r25'=`at'[1,158]
    
    scalar `r31'=`at'[1,159]
    scalar `r32'=`at'[1,160]
    scalar `r33'=`at'[1,161]    
    scalar `r34'=`at'[1,162]
    scalar `r35'=`at'[1,163]
    
    scalar `r41'=`at'[1,164]
    scalar `r42'=`at'[1,165]
    scalar `r43'=`at'[1,166]    
    scalar `r44'=`at'[1,167]
    scalar `r45'=`at'[1,168]
    
    scalar `r51'=`at'[1,169]
    scalar `r52'=`at'[1,170]
    scalar `r53'=`at'[1,171]    
    scalar `r54'=`at'[1,172]
    scalar `r55'=`at'[1,173]
    
    scalar `r61'=`at'[1,174]
    scalar `r62'=`at'[1,175]
    scalar `r63'=`at'[1,176]    
    scalar `r64'=`at'[1,177]
    scalar `r65'=`at'[1,178]
    
    scalar `r71'=`at'[1,179]
    scalar `r72'=`at'[1,180]
    scalar `r73'=`at'[1,181]    
    scalar `r74'=`at'[1,182]
    scalar `r75'=`at'[1,183]
    
    scalar `r81'=`at'[1,184]
    scalar `r82'=`at'[1,185]
    scalar `r83'=`at'[1,186]    
    scalar `r84'=`at'[1,187]
    scalar `r85'=`at'[1,188]
    
    scalar `r91'=`at'[1,189]
    scalar `r92'=`at'[1,190]
    scalar `r93'=`at'[1,191]    
    scalar `r94'=`at'[1,192]
    scalar `r95'=`at'[1,193]
    
    scalar `r101'=`at'[1,194]
    scalar `r102'=`at'[1,195]
    scalar `r103'=`at'[1,196]    
    scalar `r104'=`at'[1,197]
    scalar `r105'=`at'[1,198]
    
    scalar `r111'=`at'[1,199]
    scalar `r112'=`at'[1,200]
    scalar `r113'=`at'[1,201]    
    scalar `r114'=`at'[1,202]
    scalar `r115'=`at'[1,203]
    
    scalar `r121'=`at'[1,204]
    scalar `r122'=`at'[1,205]
    scalar `r123'=`at'[1,206]    
    scalar `r124'=`at'[1,207]
    scalar `r125'=`at'[1,208]
    
    scalar `r131'=`at'[1,209]
    scalar `r132'=`at'[1,210]
    scalar `r133'=`at'[1,211]    
    scalar `r134'=`at'[1,212]
    scalar `r135'=`at'[1,213]
    
    scalar `r141'=`at'[1,214]
    scalar `r142'=`at'[1,215]
    scalar `r143'=`at'[1,216]    
    scalar `r144'=`at'[1,217]
    scalar `r145'=`at'[1,218]
    
    tempname t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14
    scalar `t1'=`at'[1,219]
    scalar `t2'=`at'[1,220]
    scalar `t3'=`at'[1,221]    
    scalar `t4'=`at'[1,222]
    scalar `t5'=`at'[1,223]
    scalar `t6'=`at'[1,224]
    scalar `t7'=`at'[1,225]
    scalar `t8'=`at'[1,226]
    scalar `t9'=`at'[1,227]
    scalar `t10'=`at'[1,228]
    scalar `t11'=`at'[1,229]
    scalar `t12'=`at'[1,230]
    scalar `t13'=`at'[1,231]
    scalar `t14'=`at'[1,232]
    
    quietly {
        tempvar ap
        g double `ap'=`a0'+`a1'*lnp1+`a2'*lnp2+`a3'*lnp3+`a4'*lnp4+`a5'*lnp5+`a6'*lnp6+`a7'*lnp7+`a8'*lnp8+`a9'*lnp9+`a10'*lnp10+`a11'*lnp11+`a12'*lnp12+`a13'*lnp13+`a14'*lnp14+`a15'*lnp15
        forvalues i=1/15 {
            forvalues j=1/15 {
                replace `ap'=`ap'+0.5*`y'`i'`j'*`lnp`i''*`lnp`j''
            }
        }
        tempvar bp
        g double `bp'=1
        forvalues i=1/15 {
            replace `bp'=`bp'*p`i'^`b`i''
        }
        replace `w1' = `cdf1'*({`a1'} + {`y11'}*`lnp1' + {`y12'}*`lnp2' + {`y13'}*`lnp3' + {`y14'}*`lnp4' + {`y15'}*`lnp5'+ {`y16'}*`lnp6'+ {`y17'}*`lnp7'+ {`y18'}*`lnp8'+ {`y19'}*`lnp9'+ {`y110'}*`lnp10'+ {`y111'}*`lnp11'+ {`y112'}*`lnp12'+ {`y113'}*`lnp13'+ {`y114'}*`lnp14'+ {`y115'}*`lnp15' + {`b1'}*(`lnm'-`ap') + {`h1'}*(1/`bp')*(`lnm'-`ap')^2 + {`r11'}*`x1' + {`r12'}*`x2' + {`r13'}*`x3' + {`r14'}*`x4' + {`r15'}*`x5') + {`t1'}*`pdf1'
        replace `w2' = `cdf2'*({`a2'} + {`y21'}*`lnp1' + {`y22'}*`lnp2' + {`y23'}*`lnp3' + {`y24'}*`lnp4' + {`y25'}*`lnp5'+ {`y26'}*`lnp6'+ {`y27'}*`lnp7'+ {`y28'}*`lnp8'+ {`y29'}*`lnp9'+ {`y210'}*`lnp10'+ {`y211'}*`lnp11'+ {`y212'}*`lnp12'+ {`y213'}*`lnp13'+ {`y214'}*`lnp14'+ {`y215'}*`lnp15' + {`b2'}*(`lnm'-`ap') + {`h2'}*(1/`bp')*(`lnm'-`ap')^2 + {`r21'}*`x1' + {`r22'}*`x2' + {`r23'}*`x3' + {`r24'}*`x4' + {`r25'}*`x5') + {`t2'}*`pdf2'
        replace `w3' = `cdf3'*({`a3'} + {`y31'}*`lnp1' + {`y32'}*`lnp2' + {`y33'}*`lnp3' + {`y34'}*`lnp4' + {`y35'}*`lnp5'+ {`y36'}*`lnp6'+ {`y37'}*`lnp7'+ {`y38'}*`lnp8'+ {`y39'}*`lnp9'+ {`y310'}*`lnp10'+ {`y311'}*`lnp11'+ {`y312'}*`lnp12'+ {`y313'}*`lnp13'+ {`y314'}*`lnp14'+ {`y315'}*`lnp15' + {`b3'}*(`lnm'-`ap') + {`h3'}*(1/`bp')*(`lnm'-`ap')^2 + {`r31'}*`x1' + {`r32'}*`x2' + {`r33'}*`x3' + {`r34'}*`x4' + {`r35'}*`x5') + {`t3'}*`pdf3'
        replace `w4' = `cdf4'*({`a4'} + {`y41'}*`lnp1' + {`y42'}*`lnp2' + {`y43'}*`lnp3' + {`y44'}*`lnp4' + {`y45'}*`lnp5'+ {`y46'}*`lnp6'+ {`y47'}*`lnp7'+ {`y48'}*`lnp8'+ {`y49'}*`lnp9'+ {`y410'}*`lnp10'+ {`y411'}*`lnp11'+ {`y412'}*`lnp12'+ {`y413'}*`lnp13'+ {`y414'}*`lnp14'+ {`y415'}*`lnp15' + {`b4'}*(`lnm'-`ap') + {`h4'}*(1/`bp')*(`lnm'-`ap')^2 + {`r41'}*`x1' + {`r42'}*`x2' + {`r43'}*`x3' + {`r44'}*`x4' + {`r45'}*`x5') + {`t4'}*`pdf4'
        replace `w5' = `cdf5'*({`a5'} + {`y51'}*`lnp1' + {`y52'}*`lnp2' + {`y53'}*`lnp3' + {`y54'}*`lnp4' + {`y55'}*`lnp5'+ {`y56'}*`lnp6'+ {`y57'}*`lnp7'+ {`y58'}*`lnp8'+ {`y59'}*`lnp9'+ {`y510'}*`lnp10'+ {`y511'}*`lnp11'+ {`y512'}*`lnp12'+ {`y513'}*`lnp13'+ {`y514'}*`lnp14'+ {`y515'}*`lnp15' + {`b5'}*(`lnm'-`ap') + {`h5'}*(1/`bp')*(`lnm'-`ap')^2 + {`r51'}*`x1' + {`r52'}*`x2' + {`r53'}*`x3' + {`r54'}*`x4' + {`r55'}*`x5') + {`t5'}*`pdf5'
        replace `w6' = `cdf6'*({`a6'} + {`y61'}*`lnp1' + {`y62'}*`lnp2' + {`y63'}*`lnp3' + {`y64'}*`lnp4' + {`y65'}*`lnp5'+ {`y66'}*`lnp6'+ {`y67'}*`lnp7'+ {`y68'}*`lnp8'+ {`y69'}*`lnp9'+ {`y610'}*`lnp10'+ {`y611'}*`lnp11'+ {`y612'}*`lnp12'+ {`y613'}*`lnp13'+ {`y614'}*`lnp14'+ {`y615'}*`lnp15' + {`b6'}*(`lnm'-`ap') + {`h6'}*(1/`bp')*(`lnm'-`ap')^2 + {`r61'}*`x1' + {`r62'}*`x2' + {`r63'}*`x3' + {`r64'}*`x4' + {`r65'}*`x5') + {`t6'}*`pdf6'
        replace `w7' = `cdf7'*({`a7'} + {`y71'}*`lnp1' + {`y72'}*`lnp2' + {`y73'}*`lnp3' + {`y74'}*`lnp4' + {`y75'}*`lnp5'+ {`y76'}*`lnp6'+ {`y77'}*`lnp7'+ {`y78'}*`lnp8'+ {`y79'}*`lnp9'+ {`y710'}*`lnp10'+ {`y711'}*`lnp11'+ {`y712'}*`lnp12'+ {`y713'}*`lnp13'+ {`y714'}*`lnp14'+ {`y715'}*`lnp15' + {`b7'}*(`lnm'-`ap') + {`h7'}*(1/`bp')*(`lnm'-`ap')^2 + {`r71'}*`x1' + {`r72'}*`x2' + {`r73'}*`x3' + {`r74'}*`x4' + {`r75'}*`x5') + {`t7'}*`pdf7'
        replace `w8' = `cdf8'*({`a8'} + {`y81'}*`lnp1' + {`y82'}*`lnp2' + {`y83'}*`lnp3' + {`y84'}*`lnp4' + {`y85'}*`lnp5'+ {`y86'}*`lnp6'+ {`y87'}*`lnp7'+ {`y88'}*`lnp8'+ {`y89'}*`lnp9'+ {`y810'}*`lnp10'+ {`y811'}*`lnp11'+ {`y812'}*`lnp12'+ {`y813'}*`lnp13'+ {`y814'}*`lnp14'+ {`y815'}*`lnp15' + {`b8'}*(`lnm'-`ap') + {`h8'}*(1/`bp')*(`lnm'-`ap')^2 + {`r81'}*`x1' + {`r82'}*`x2' + {`r83'}*`x3' + {`r84'}*`x4' + {`r85'}*`x5') + {`t8'}*`pdf8'
        replace `w9' = `cdf9'*({`a9'} + {`y91'}*`lnp1' + {`y92'}*`lnp2' + {`y93'}*`lnp3' + {`y94'}*`lnp4' + {`y95'}*`lnp5'+ {`y96'}*`lnp6'+ {`y97'}*`lnp7'+ {`y98'}*`lnp8'+ {`y99'}*`lnp9'+ {`y910'}*`lnp10'+ {`y911'}*`lnp11'+ {`y912'}*`lnp12'+ {`y913'}*`lnp13'+ {`y914'}*`lnp14'+ {`y915'}*`lnp15' + {`b9'}*(`lnm'-`ap') + {`h9'}*(1/`bp')*(`lnm'-`ap')^2 + {`r91'}*`x1' + {`r92'}*`x2' + {`r93'}*`x3' + {`r94'}*`x4' + {`r95'}*`x5') + {`t9'}*`pdf9'
        replace `w10' = `cdf10'*({`a10'} + {`y101'}*`lnp1' + {`y102'}*`lnp2' + {`y103'}*`lnp3' + {`y104'}*`lnp4' + {`y105'}*`lnp5'+ {`y106'}*`lnp6'+ {`y107'}*`lnp7'+ {`y108'}*`lnp8'+ {`y109'}*`lnp9'+ {`y1010'}*`lnp10'+ {`y1011'}*`lnp11'+ {`y1012'}*`lnp12'+ {`y1013'}*`lnp13'+ {`y1014'}*`lnp14'+ {`y1015'}*`lnp15' + {`b10'}*(`lnm'-`ap') + {`h10'}*(1/`bp')*(`lnm'-`ap')^2 + {`r101'}*`x1' + {`r102'}*`x2' + {`r103'}*`x3' + {`r104'}*`x4' + {`r105'}*`x5') + {`t10'}*`pdf10'
        replace `w11' = `cdf11'*({`a11'} + {`y111'}*`lnp1' + {`y112'}*`lnp2' + {`y113'}*`lnp3' + {`y114'}*`lnp4' + {`y115'}*`lnp5'+ {`y116'}*`lnp6'+ {`y117'}*`lnp7'+ {`y118'}*`lnp8'+ {`y119'}*`lnp9'+ {`y1110'}*`lnp10'+ {`y1111'}*`lnp11'+ {`y1112'}*`lnp12'+ {`y1113'}*`lnp13'+ {`y1114'}*`lnp14'+ {`y1115'}*`lnp15' + {`b11'}*(`lnm'-`ap') + {`h11'}*(1/`bp')*(`lnm'-`ap')^2 + {`r111'}*`x1' + {`r112'}*`x2' + {`r113'}*`x3' + {`r114'}*`x4' + {`r115'}*`x5') + {`t11'}*`pdf11'
        replace `w12' = `cdf12'*({`a12'} + {`y121'}*`lnp1' + {`y122'}*`lnp2' + {`y123'}*`lnp3' + {`y124'}*`lnp4' + {`y125'}*`lnp5'+ {`y126'}*`lnp6'+ {`y127'}*`lnp7'+ {`y128'}*`lnp8'+ {`y129'}*`lnp9'+ {`y1210'}*`lnp10'+ {`y1211'}*`lnp11'+ {`y1212'}*`lnp12'+ {`y1213'}*`lnp13'+ {`y1214'}*`lnp14'+ {`y1215'}*`lnp15' + {`b12'}*(`lnm'-`ap') + {`h12'}*(1/`bp')*(`lnm'-`ap')^2 + {`r121'}*`x1' + {`r122'}*`x2' + {`r123'}*`x3' + {`r124'}*`x4' + {`r125'}*`x5') + {`t12'}*`pdf12'
        replace `w13' = `cdf13'*({`a13'} + {`y131'}*`lnp1' + {`y132'}*`lnp2' + {`y133'}*`lnp3' + {`y134'}*`lnp4' + {`y135'}*`lnp5'+ {`y136'}*`lnp6'+ {`y137'}*`lnp7'+ {`y138'}*`lnp8'+ {`y139'}*`lnp9'+ {`y1310'}*`lnp10'+ {`y1311'}*`lnp11'+ {`y1312'}*`lnp12'+ {`y1313'}*`lnp13'+ {`y1314'}*`lnp14'+ {`y1315'}*`lnp15' + {`b13'}*(`lnm'-`ap') + {`h13'}*(1/`bp')*(`lnm'-`ap')^2 + {`r131'}*`x1' + {`r132'}*`x2' + {`r133'}*`x3' + {`r134'}*`x4' + {`r135'}*`x5') + {`t13'}*`pdf13'
        replace `w14' = `cdf14'*({`a14'} + {`y141'}*`lnp1' + {`y142'}*`lnp2' + {`y143'}*`lnp3' + {`y144'}*`lnp4' + {`y145'}*`lnp5'+ {`y146'}*`lnp6'+ {`y147'}*`lnp7'+ {`y148'}*`lnp8'+ {`y149'}*`lnp9'+ {`y1410'}*`lnp10'+ {`y1411'}*`lnp11'+ {`y1412'}*`lnp12'+ {`y1413'}*`lnp13'+ {`y1414'}*`lnp14'+ {`y1415'}*`lnp15' + {`b14'}*(`lnm'-`ap') + {`h14'}*(1/`bp')*(`lnm'-`ap')^2 + {`r141'}*`x1' + {`r142'}*`x2' + {`r143'}*`x3' + {`r144'}*`x4' + {`r145'}*`x5') + {`t14'}*`pdf14'
    }

end

nlsur quaids @ w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13 w14 lnp1 lnp2 lnp3 lnp4 lnp5 lnp6 lnp7 lnp8 lnp9 lnp10 lnp11 lnp12 lnp13 lnp14 lnp15 lnm cdf1 cdf2 cdf3 cdf4 cdf5 cdf6 cdf7 cdf8 cdf9 cdf10 cdf11 cdf12 cdf13 cdf14 x1 x2 x3 x4 x5 pdf1 pdf2 pdf3 pdf4 pdf5 pdf6 pdf7 pdf8 pdf9 pdf10 pdf11 pdf12 pdf13 pdf14, parameters(a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 b12 b13 b14 y11 y12 y13 y14 y15 y16 y17 y18 y19 y110 y111 y112 y113 y114 y22 y23 y24 y25 y26 y27 y28 y29 y210 y211 y212 y213 y214 y33 y34 y35 y36 y37 y38 y39 y310 y311 y312 y313 y314 y44 y45 y46 y47 y48 y49 y410 y411 y412 y413 y414 y55 y56 y57 y58 y59 y510 y511 y512 y513 y514 y66 y67 y68 y69 y610 y611 y612 y613 y614 y77 y78 y79 y710 y711 y712 y713 y714 y88 y89 y810 y811 y812 y813 y814 y99 y910 y911 y912 y913 y914 y1010 y1011 y1012 y1013 y1014 y1111 y1112 y1113 y1114 y1212 y1213 y1214 y1313 y1314 y1414 h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 r11 r12 r13 r14 r15 r21 r22 r23 r24 r25 r31 r32 r33 r34 r35 r41 r42 r43 r44 r45 r51 r52 r53 r54 r55 r61 r62 r63 r64 r65 r71 r72 r73 r74 r75 r81 r82 r83 r84 r85 r91 r92 r93 r94 r95 r101 r102 r103 r104 r105 r111 r112 r113 r114 r115 r121 r122 r123 r124 r125 r131 r132 r133 r134 r135 r141 r142 r143 r144 r145 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14) neq(14) ifgnls