Hi everyone, I wish everything is good.
I have the following nlsur code estimates:
I want to show the results in a better design using collect commands:
How can I split the values of the coefficients that begins by a0, o1, o2, ..., o10 and l in one first table with three different columns (one for each equation one, two and three) and the remain coefficients at a second only one column table?
I appreciate any suggests.
Have all a great day.
I have the following nlsur code estimates:
Code:
drop _all program drop _all use https://www.stata-press.com/data/r18/food, clear program nlsuraids version 17.0 syntax varlist(min=8 max=8) if, at(name) tokenize `varlist' args w1 w2 w3 lnp1 lnp2 lnp3 lnp4 lnm tempname a1 a2 a3 a4 scalar `a1' = `at'[1,1] scalar `a2' = `at'[1,2] scalar `a3' = `at'[1,3] scalar `a4' = 1- `a1'- `a2'- `a3' tempname b1 b2 b3 scalar `b1' = `at'[1,4] scalar `b2' = `at'[1,5] scalar `b3' = `at'[1,6] tempname g11 g12 g13 g14 tempname g21 g22 g23 g24 tempname g31 g32 g33 g34 tempname g41 g42 g43 g44 scalar `g11' = `at'[1,7] scalar `g12' = `at'[1,8] scalar `g13' = `at'[1,9] scalar `g14' =-`g11'-`g12'-`g13' scalar `g21' = `g12' scalar `g22' = `at'[1,10] scalar `g23' = `at'[1,11] scalar `g24' =-`g21'-`g22'-`g23' scalar `g31' = `g13' scalar `g32' = `g23' scalar `g33' = `at'[1,12] scalar `g34' =-`g31'-`g32'-`g33' scalar `g41' = `g14' scalar `g42' = `g24' scalar `g43' = `g34' scalar `g44' =-`g41'-`g42'-`g43' quietly { tempvar lnpindex gen double `lnpindex' = 5 + `a1' * `lnp1' + `a2'*`lnp2' + `a3'*`lnp3' + `a4'*`lnp4' forvalues i = 1/4 { forvalues j = 1/4 { replace `lnpindex' = `lnpindex' + 0.5*`g`i'`j'' *`lnp`i''*`lnp`j'' } } replace `w1' = `a1' + `g11'*`lnp1' + `g12'*`lnp2' + `g13'*`lnp3' + `g14'*`lnp4' + `b1'*(`lnm'- `lnpindex') replace `w2' = `a2' + `g21'*`lnp1' + `g22'*`lnp2' + `g23'*`lnp3' + `g24'*`lnp4' + `b2'*(`lnm'- `lnpindex') replace `w3' = `a3' + `g31'*`lnp1' + `g32'*`lnp2' + `g33'*`lnp3' + `g34'*`lnp4' + `b3'*(`lnm'- `lnpindex') } end nlsur aids @ w1 w2 w3 lnp1 lnp2 lnp3 lnp4 lnexp, /// parameters(a1 a2 a3 b1 b2 b3 g11 g12 g13 g22 g32 g33) neq(3) ifgnls
Code:
. qui collect : nlsur aids @ w1 w2 w3 lnp1 lnp2 lnp3 lnp4 lnexp, /// > parameters(a1 a2 a3 b1 b2 b3 g11 g12 g13 g22 g32 g33) neq(3) ifgnls . collect dims Collection dimensions Collection: default ----------------------------------------- Dimension No. levels ----------------------------------------- Layout, style, header, label cmdset 4 coleq 12 colname 46 program_class 2 result 47 result_type 3 rowname 4 Style only border_block 4 cell_type 4 ----------------------------------------- . . collect layout (colname) (result[_r_b _r_p]) Collection: default Rows: colname Columns: result[_r_b _r_p] Table 1: 35 x 2 --------------------------- | Coefficient p-value ------+-------------------- a01 | .014511 0.000 a02 | .0083158 0.000 a03 | .9771733 0.000 o1_1 | .0008832 0.045 o2_1 | .0006086 0.113 o3_1 | .0010754 0.002 o4_1 | -.0040338 0.000 o5_1 | -.0020791 0.000 o6_1 | -.0016119 0.000 o7_1 | .0070374 0.000 o8_1 | .0008619 0.001 o9_1 | -.0017339 0.000 o10_1 | -.0009389 0.000 o1_2 | .0048446 0.000 o2_2 | .001181 0.016 o3_2 | -.003873 0.000 o4_2 | -.0023216 0.000 o5_2 | -.0044547 0.000 o6_2 | -.0010955 0.000 o7_2 | .0055788 0.000 o8_2 | .0007144 0.000 o9_2 | -.0001183 0.518 o10_2 | -.0004092 0.000 o11_1 | -.0000689 0.000 o11_2 | -.0000464 0.000 g11 | -.0026987 0.000 g12 | .0002518 0.055 g21 | .0002518 0.055 g22 | .0003642 0.319 g13 | .0024468 0.000 g23 | -.000616 0.094 g33 | .0018308 0.000 l1 | -.0002066 0.008 l2 | -.0001653 0.001 l3 | .0003719 0.000 ---------------------------
I appreciate any suggests.
Have all a great day.