-
Notifications
You must be signed in to change notification settings - Fork 3
/
cs_rlasso.do
959 lines (888 loc) · 33.2 KB
/
cs_rlasso.do
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
* certification script for
* lassopack package 1.2.01XX 19aug2020, MS
cscript rlasso adofile rlasso
clear all
capture log close
set more off
set rmsg on
program drop _all
log using cs_rlasso, replace
about
which rlasso
which lassoutils
// original code by CBH, modified to use quad precision etc.; not needed.
cap noi which lassoShootingCBH
cap noi which lassoClusterCBH
// Initial checks of rlasso are vs. CBH code.
// Other checks include equivalences that should hold in theory:
// 1. Partialling-out vs. unpenalized regressors.
// 2. Standardization "on the fly" (default) vs. pre-standardization of data.
// 3. Het-robust loadings vs. cluster-robust loadings with singleton clusters.
// 4. Fixed effects vs. unpenalized dummies.
// Currently uses Kiel-McClain 1995 housing/incinerator example dataset.
// Includes some badly-scaled variables so useful.
qui bcuse kielmc, clear
gen lcbd=ln(cbd)
gen lcbdsq=lcbd^2
gen byte one=1
gen n=_n
gen id=ceil(_n/10)
******************************************************************************
// Check vs. CBH code
// Note that as of lassoutils 1.1.01 08nov2018 we need to set the c0 option.
// homoskedastic
/*
lassoShootingCBH lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
het(0) verb(0) tolzero(1e-10) tolups(1e-10) ltol(1e-8) maxiter(10000)
mat CBHbetaL=r(betaL)'
mat CBHbetaPL=r(betaPL)'
scalar lambda=r(lambda)
local s = colsof(CBHbetaL)
*/
mat CBHbetaL = .55033459 , .0958016 , .00259465
mat CBHbetaPL = .65128713 , .15561146 , .01297576
scalar lambda = 144.22858784
local s = 3
// Basic
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
lalt corrnum(0) tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8) ///
maxiter(10000) c0(0.55)
mat b=e(b)
mat beta=e(beta)
mat betaOLS=e(betaOLS)
assert mreldif(b,beta)<1e-8
mat beta=beta[1,1..`s']
mat betaOLS=betaOLS[1,1..`s']
assert mreldif(beta,CBHbetaL)<1e-8
assert mreldif(betaOLS,CBHbetaPL)<1e-8
assert reldif(lambda,e(lambda0))<1e-8
// Partial-out constant
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
lalt corrnum(0) partial(_cons) tolzero(1e-10) tolpsi(1e-10) ///
tolopt(1e-8) maxiter(10000) c0(0.55)
mat b=e(b)
mat beta=e(beta)
mat betaOLS=e(betaOLS)
assert mreldif(b,beta)<1e-8
mat beta=beta[1,1..`s']
mat betaOLS=betaOLS[1,1..`s']
assert mreldif(beta,CBHbetaL)<1e-8
assert mreldif(betaOLS,CBHbetaPL)<1e-8
assert reldif(lambda,e(lambda0))<1e-8
// Include unpenalized constant by hand
// Needs high setting for maxpsiiter
// Also needs looser tolerance
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc one, ///
lalt corrnum(0) tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8) ///
maxiter(10000) nocons pnotpen(one) maxpsiiter(10) c0(0.55) psolver(chol)
mat b=e(b)
mat beta=e(beta)
mat betaOLS=e(betaOLS)
mat beta=beta[1,1..`s']
mat betaOLS=betaOLS[1,1..`s']
assert mreldif(beta,CBHbetaL)<1e-5 // looser tolerance
assert mreldif(betaOLS,CBHbetaPL)<1e-8
assert reldif(lambda,e(lambda0))<1e-8
******************************************************************************
// Check vs. CBH code
// With controls/pnotpen - note that controls do not appear in CBH X list
// Needs high setting for maxpsiiter
// Needs looser tolerance
/*
lassoShootingCBH lrprice intst lintst y81ldist lintstsq y81nrinc, ///
het(0) verb(0) tolzero(1e-10) tolups(1e-10) ltol(1e-8) maxiter(10000) controls(larea cbd)
mat CBHbetaL=r(betaL)'
mat CBHbetaPL=r(betaPL)'
scalar lambda=r(lambda)
local s = colsof(CBHbetaL)
*/
mat CBHbetaL = .04572585 , .00175637
mat CBHbetaPL = .20415454 , .01272592
scalar lambda = 140.55736231
local s = 2
// pnotpen
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
lalt corrnum(0) partial(_cons) tolzero(1e-10) tolpsi(1e-10) ///
tolopt(1e-8) maxiter(10000) maxpsiiter(10) pnotpen(larea cbd) ///
c0(0.55)
mat b=e(b)
mat beta=e(beta)
mat betaOLS=e(betaOLS)
assert mreldif(b,beta)<1e-8
// trim
mat beta=beta[1,3..4]
mat betaOLS=betaOLS[1,3..4]
local s = colsof(CBHbetaL)
forvalues i=1/`s' {
assert reldif(CBHbetaL[1,`i'],beta[1,`i'])<1e-6
assert reldif(CBHbetaPL[1,`i'],betaOLS[1,`i'])<1e-6
}
assert reldif(lambda,e(lambda0))<1e-8
// partial
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
lalt corrnum(0) tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8) ///
maxiter(10000) maxpsiiter(10) partial(larea cbd)
mat b=e(b)
mat beta=e(beta)
mat betaOLS=e(betaOLS)
assert mreldif(b,beta)<1e-8
// trim
mat beta=beta[1,1..2]
mat betaOLS=betaOLS[1,1..2]
local s = colsof(CBHbetaL)
forvalues i=1/`s' {
assert reldif(CBHbetaL[1,`i'],beta[1,`i'])<1e-8
assert reldif(CBHbetaPL[1,`i'],betaOLS[1,`i'])<1e-8
}
assert reldif(lambda,e(lambda0))<1e-8
******************************************************************************
// Check vs CBH code
// heteroskedastic
/*
lassoShootingCBH lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
het(1) verb(0) tolzero(1e-10) tolups(1e-10) ltol(1e-8) maxiter(10000)
mat CBHbetaL=r(betaL)'
mat CBHbetaPL=r(betaPL)'
scalar lambda=r(lambda)
local s = colsof(CBHbetaL)
*/
mat CBHbetaL = .52823835 , .09894578 , .0030307
mat CBHbetaPL = .65128713 , .15561146 , .01297576
scalar lambda = 144.22858784
local s = 3
// Basic
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
rob lalt corrnum(0) tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8) ///
maxiter(10000) c0(0.55)
mat b=e(b)
mat beta=e(beta)
mat betaOLS=e(betaOLS)
assert mreldif(b,beta)<1e-8
forvalues i=1/`s' {
assert reldif(CBHbetaL[1,`i'],beta[1,`i'])<1e-8
assert reldif(CBHbetaPL[1,`i'],betaOLS[1,`i'])<1e-8
}
assert reldif(lambda,e(lambda0))<1e-8
// partial-out cons
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
rob lalt corrnum(0) partial(_cons) tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8) maxiter(10000) c0(0.55)
mat b=e(b)
mat beta=e(beta)
mat betaOLS=e(betaOLS)
assert mreldif(b,beta)<1e-8
local s = colsof(CBHbetaL)
forvalues i=1/`s' {
assert reldif(CBHbetaL[1,`i'],beta[1,`i'])<1e-8
assert reldif(CBHbetaPL[1,`i'],betaOLS[1,`i'])<1e-8
}
assert reldif(lambda,e(lambda0))<1e-8
// With controls/pnotpen - note that controls do not appear in CBH X list
/*
lassoShootingCBH lrprice intst lintst y81ldist lintstsq y81nrinc, ///
het(1) verb(0) tolzero(1e-10) tolups(1e-10) ltol(1e-8) maxiter(10000) controls(larea cbd)
mat CBHbetaL=r(betaL)'
mat CBHbetaPL=r(betaPL)'
scalar lambda=r(lambda)
*/
mat CBHbetaL = .01229867 , .00161341
mat CBHbetaPL = .20415454 , .01272592
scalar lambda = 140.55736231
local s = 2
// pnotpen
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
rob lalt corrnum(0) partial(_cons) tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8) maxiter(10000) pnotpen(larea cbd) c0(0.55)
mat b=e(b)
mat beta=e(beta)
mat betaOLS=e(betaOLS)
assert mreldif(b,beta)<1e-8
// trim
mat beta=beta[1,3..4]
mat betaOLS=betaOLS[1,3..4]
forvalues i=1/`s' {
assert reldif(CBHbetaL[1,`i'],beta[1,`i'])<1e-6
assert reldif(CBHbetaPL[1,`i'],betaOLS[1,`i'])<1e-6
}
assert reldif(lambda,e(lambda0))<1e-8
// partial
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
rob lalt corrnum(0) tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8) maxiter(10000) partial(larea cbd) c0(0.55)
mat b=e(b)
mat beta=e(beta)
mat betaOLS=e(betaOLS)
assert mreldif(b,beta)<1e-8
// trim
mat beta=beta[1,1..2]
mat betaOLS=betaOLS[1,1..2]
local s = colsof(CBHbetaL)
forvalues i=1/`s' {
assert reldif(CBHbetaL[1,`i'],beta[1,`i'])<1e-8
assert reldif(CBHbetaPL[1,`i'],betaOLS[1,`i'])<1e-8
}
assert reldif(lambda,e(lambda0))<1e-8
********************** CLUSTER *********************************
// Check vs CBH code
// Update 4 Apr 2018:
// CBH cluster code lambda = 2.2*sqrt(nclust)*invnorm(1-(.1/log(nclust))/(2p))
// JBES paper and updated rlasso use 2,2*sqrt(n)*invnorm,
// i.e., same as standard lasso. Comparisons with CBH lambda commented out.
// clustering (note no lalt required)
// note center and maxupsiter are required to match CBH code
/*
lassoClusterCBH lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
cluster(age) verb(0) tolzero(1e-10) tolups(1e-10) ltol(1e-8) maxiter(10000)
mat CBHbetaL=r(betaL)'
mat CBHbetaPL=r(betaPL)'
scalar lambda=r(lambda)
*/
mat CBHbetaL = .46261782 , .11510062
mat CBHbetaPL = .68488126 , .15090246
scalar lambda = 50.21173664
local s = 2
// Basic
// need nclust1 option to replicate CBH
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
cluster(age) center corrnum(0) nclust1 ///
tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8) ///
maxiter(10000) maxpsiiter(10) c0(0.55)
mat b=e(b)
mat beta=e(beta)
mat betaOLS=e(betaOLS)
assert mreldif(b,beta)<1e-8
forvalues i=1/`s' {
assert reldif(CBHbetaL[1,`i'],beta[1,`i'])<1e-8
assert reldif(CBHbetaPL[1,`i'],betaOLS[1,`i'])<1e-8
}
// assert reldif(lambda,e(lambda0))<1e-8
// partial-out cons
// need nclust1 option to replicate CBH
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
cluster(age) center corrnum(0) nclust1 ///
partial(_cons) tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8) ///
maxiter(10000) maxpsiiter(10) c0(0.55)
mat b=e(b)
mat beta=e(beta)
mat betaOLS=e(betaOLS)
assert mreldif(b,beta)<1e-8
forvalues i=1/`s' {
assert reldif(CBHbetaL[1,`i'],beta[1,`i'])<1e-8
assert reldif(CBHbetaPL[1,`i'],betaOLS[1,`i'])<1e-8
}
// assert reldif(lambda,e(lambda0))<1e-8
// With controls/pnotpen - note that controls do not appear in CBH X list
/*
lassoClusterCBH lrprice intst lintst y81ldist lintstsq y81nrinc, ///
cluster(age) verb(0) tolzero(1e-10) tolups(1e-10) ltol(1e-8) maxiter(10000) controls(larea cbd)
mat CBHbetaL=r(betaL)'
mat CBHbetaPL=r(betaPL)'
scalar lambda=r(lambda)
*/
mat CBHbetaL = .00552125 , .00301795
mat CBHbetaPL = .01283716 , .01236437
scalar lambda = 48.38313172
local s = 2
// pnotpen
// need nclust1 option to replicate CBH
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
cluster(age) center corrnum(0) nclust1 ///
tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8) maxiter(10000) ///
pnotpen(larea cbd) maxpsiiter(10) c0(0.55)
mat b=e(b)
mat beta=e(beta)
mat betaOLS=e(betaOLS)
assert mreldif(b,beta)<1e-8
// trim
mat beta=beta[1,3..4]
mat betaOLS=betaOLS[1,3..4]
forvalues i=1/`s' {
assert reldif(CBHbetaL[1,`i'],beta[1,`i'])<1e-6
assert reldif(CBHbetaPL[1,`i'],betaOLS[1,`i'])<1e-6
}
// assert reldif(lambda,e(lambda0))<1e-8
// partial
// need nclust1 option to replicate CBH
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
cluster(age) center corrnum(0) nclust1 ///
tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8) maxiter(10000) ///
partial(larea cbd) maxpsiiter(10) c0(0.55)
mat b=e(b)
mat beta=e(beta)
mat betaOLS=e(betaOLS)
assert mreldif(b,beta)<1e-8
// trim
mat beta=beta[1,1..2]
mat betaOLS=betaOLS[1,1..2]
forvalues i=1/`s' {
assert reldif(CBHbetaL[1,`i'],beta[1,`i'])<1e-8
assert reldif(CBHbetaPL[1,`i'],betaOLS[1,`i'])<1e-8
}
// assert reldif(lambda,e(lambda0))<1e-8
********************** CLUSTER+FE *********************************
// Check vs. CBH code.
xtset age
// clustering (note no lalt required) + fixed effects
// note center and maxpsiiter are required to match CBH code
/*
lassoClusterCBH lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
cluster(age) fix(age) verb(0) tolzero(1e-10) tolups(1e-10) ltol(1e-8) maxiter(10000)
mat CBHbetaL=r(betaL)'
mat CBHbetaPL=r(betaPL)'
scalar lambda=r(lambda)
*/
mat CBHbetaL = .38441642 , .00767435
mat CBHbetaPL = .53696874 , .01285201
scalar lambda = 50.21173664
local s = 2
// Basic
// need nclust1 option to replicate CBH
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
cluster(age) fe center corrnum(0) nclust1 ///
tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8) ///
maxiter(10000) maxpsiiter(10) c0(0.55)
mat b=e(b)
mat beta=e(beta)
mat betaOLS=e(betaOLS)
assert mreldif(b,beta)<1e-8
forvalues i=1/`s' {
assert reldif(CBHbetaL[1,`i'],beta[1,`i'])<1e-8
assert reldif(CBHbetaPL[1,`i'],betaOLS[1,`i'])<1e-8
}
// assert reldif(lambda,e(lambda0))<1e-8
// With controls/pnotpen - note that controls do not appear in CBH X list
/*
lassoClusterCBH lrprice intst lintst y81ldist lintstsq y81nrinc, ///
cluster(age) fix(age) verb(0) tolzero(1e-10) tolups(1e-10) ltol(1e-8) maxiter(10000) controls(larea cbd)
mat CBHbetaL=r(betaL)'
mat CBHbetaPL=r(betaPL)'
scalar lambda=r(lambda)
*/
mat CBHbetaL = .00308359
mat CBHbetaPL = .01266582
scalar lambda = 48.38313172
local s = 1
// pnotpen
// need nclust1 option to replicate CBH
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
cluster(age) fe center corrnum(0) nclust1 ///
tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8) maxiter(10000) ///
pnotpen(larea cbd) maxpsiiter(10) c0(0.55)
mat b=e(b)
mat beta=e(beta)
mat betaOLS=e(betaOLS)
assert mreldif(b,beta)<1e-8
// trim
mat beta=beta[1,3..3]
mat betaOLS=betaOLS[1,3..3]
forvalues i=1/`s' {
assert reldif(CBHbetaL[1,`i'],beta[1,`i'])<1e-6
assert reldif(CBHbetaPL[1,`i'],betaOLS[1,`i'])<1e-6
}
// assert reldif(lambda,e(lambda0))<1e-8
// partial
// need nclust1 option to replicate CBH
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
cluster(age) fe center corrnum(0) nclust1 ///
tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8) maxiter(10000) ///
partial(larea cbd) maxpsiiter(10) c0(0.55)
mat b=e(b)
mat beta=e(beta)
mat betaOLS=e(betaOLS)
assert mreldif(b,beta)<1e-8
// trim
mat beta=beta[1,1..1]
mat betaOLS=betaOLS[1,1..1]
forvalues i=1/`s' {
assert reldif(CBHbetaL[1,`i'],beta[1,`i'])<1e-8
assert reldif(CBHbetaPL[1,`i'],betaOLS[1,`i'])<1e-8
}
// assert reldif(lambda,e(lambda0))<1e-8
***************************************************************
// Equivalence check
// Robust vs. singleton clusters - should match
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
rob tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8) maxiter(10000) maxpsiiter(10)
savedresults save rob e()
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
cluster(n) tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8) maxiter(10000) maxpsiiter(10)
savedresults comp rob e(), exclude(macro: cmdline robust cluster) tol(1e-8)
// center option
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
rob center tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8) maxiter(10000) maxpsiiter(10)
savedresults save rob e()
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
cluster(n) center tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8) maxiter(10000) maxpsiiter(10)
savedresults comp rob e(), exclude(macro: cmdline robust cluster) tol(1e-8)
// partial and pnotpen
// with constant
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
partial(lintst y81ldist)
savedresults save partial e()
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
pnotpen(lintst y81ldist)
savedresults comp partial e(), exclude( ///
macro: cmdline pnotpen partial varXmodel ///
scalar: niter pminus pnotpen_ct partial_ct r2 ///
matrix: betaAll betaAllOLS Psi ePsi sPsi /// order/components differ
) tol(1e-8)
// with constant + prestd
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
partial(lintst y81ldist) prestd
savedresults save partial e()
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
pnotpen(lintst y81ldist) prestd
savedresults comp partial e(), exclude( ///
macro: cmdline pnotpen partial varXmodel ///
scalar: niter pminus pnotpen_ct partial_ct r2 ///
matrix: betaAll betaAllOLS Psi ePsi sPsi /// order/components differ
) tol(1e-8)
// with constant + sqrt
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
partial(lintst y81ldist) sqrt
savedresults save partial e()
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
pnotpen(lintst y81ldist) sqrt
savedresults comp partial e(), exclude( ///
macro: cmdline pnotpen partial varXmodel ///
scalar: niter pminus pnotpen_ct partial_ct r2 ///
matrix: betaAll betaAllOLS Psi ePsi sPsi /// order/components differ
) tol(1e-8)
// nocons - need an easier minimization
rlasso lrprice nbh rooms baths y81 nearinc y81nrinc, ///
partial(nearinc y81nrinc) nocons
savedresults save partial e()
rlasso lrprice nbh rooms baths y81 nearinc y81nrinc, ///
pnotpen(nearinc y81nrinc) nocons
savedresults comp partial e(), exclude( ///
macro: cmdline pnotpen partial varXmodel ///
scalar: niter pminus pnotpen_ct partial_ct r2 ///
matrix: betaAll betaAllOLS Psi ePsi sPsi /// order/components differ
) tol(1e-8)
// nocons + prestd
rlasso lrprice nbh rooms baths y81 nearinc y81nrinc, ///
partial(nearinc y81nrinc) nocons prestd
savedresults save partial e()
rlasso lrprice nbh rooms baths y81 nearinc y81nrinc, ///
pnotpen(nearinc y81nrinc) nocons prestd
savedresults comp partial e(), exclude( ///
macro: cmdline pnotpen partial varXmodel ///
scalar: niter pminus pnotpen_ct partial_ct r2 ///
matrix: betaAll betaAllOLS Psi ePsi sPsi /// order/components differ
) tol(1e-8)
// nocons + sqrt
rlasso lrprice nbh rooms baths y81 nearinc y81nrinc, ///
partial(nearinc y81nrinc) nocons sqrt
savedresults save partial e()
rlasso lrprice nbh rooms baths y81 nearinc y81nrinc, ///
pnotpen(nearinc y81nrinc) nocons sqrt
savedresults comp partial e(), exclude( ///
macro: cmdline pnotpen partial varXmodel ///
scalar: niter pminus pnotpen_ct partial_ct r2 ///
matrix: betaAll betaAllOLS Psi ePsi sPsi /// order/components differ
) tol(1e-8)
// psolver option
rlasso lrprice nbh rooms baths y81 nearinc y81nrinc, ///
partial(nearinc y81nrinc)
savedresults save partial e()
// default solver is qrxx = QR+quadcross
foreach solver in svd svdxx qr lu luxx chol {
rlasso lrprice nbh rooms baths y81 nearinc y81nrinc, ///
partial(nearinc y81nrinc) psolver(`solver')
savedresults comp partial e(), exclude( ///
macro: cmdline ///
) tol(1e-8)
}
********************** FE ONLY *********************************
// Equivalence check
// fe vs. explicit dummies
xtset age
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
fe tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8) maxiter(10000) maxpsiiter(10)
mat b=e(b)
mat beta=e(beta)
mat betaOLS=e(betaOLS)
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc i.age, ///
partial(i.age) tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8) maxiter(10000) maxpsiiter(10)
mat btemp=(el(e(b),1,1), el(e(b),1,2))
assert mreldif(b,btemp)<1e-8
mat btemp=(el(e(beta),1,1), el(e(beta),1,2))
assert mreldif(beta,btemp)<1e-8
mat btemp=(el(e(betaOLS),1,1), el(e(betaOLS),1,2))
assert mreldif(betaOLS,btemp)<1e-8
// Controls vs pnotpen
xtset age
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
fe partial(larea cbd) tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8)
mat b=e(b)
mat beta=e(beta)
mat betaOLS=e(betaOLS)
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, ///
fe pnotpen(larea cbd) tolzero(1e-10) tolpsi(1e-10) tolopt(1e-8)
mat btemp=e(b)
assert reldif(b[1,1],btemp[1,3])<1e-8
assert reldif(b[1,2],btemp[1,1])<1e-8
assert reldif(b[1,3],btemp[1,2])<1e-8
mat btemp=e(beta)
assert reldif(beta[1,1],btemp[1,3])<1e-8
assert reldif(beta[1,2],btemp[1,1])<1e-8
assert reldif(beta[1,3],btemp[1,2])<1e-8
mat btemp=e(betaOLS)
assert reldif(betaOLS[1,1],btemp[1,3])<1e-8
assert reldif(betaOLS[1,2],btemp[1,1])<1e-8
assert reldif(betaOLS[1,3],btemp[1,2])<1e-8
// noftools option
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, fe
savedresults save ftools e()
cap noi assert "`e(noftools)'"=="" // will be error if ftools not installed
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, fe noftools
assert "`e(noftools)'"=="noftools"
savedresults comp ftools e(), exclude(macro: cmdline) tol(1e-10)
********************** Standardization **************************
foreach opt in " " "sqrt" {
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, rob `opt'
savedresults save nostd e()
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, prestd rob `opt'
savedresults comp nostd e(), exclude(macro: cmdline scalar: niter matrix: Psi) tol(1e-8)
rlasso lrprice larea lintst y81ldist lintstsq y81nrinc, rob `opt' pnotpen(larea lintst)
savedresults save nostd e()
rlasso lrprice larea lintst y81ldist lintstsq y81nrinc, prestd rob `opt' pnotpen(larea lintst)
savedresults comp nostd e(), exclude(macro: cmdline scalar: niter matrix: Psi) tol(1e-8)
rlasso lrprice larea lintst y81ldist lintstsq y81nrinc, rob `opt' partial(larea lintst)
savedresults save nostd e()
rlasso lrprice larea lintst y81ldist lintstsq y81nrinc, prestd rob `opt' partial(larea lintst)
savedresults comp nostd e(), exclude(macro: cmdline scalar: niter matrix: Psi) tol(1e-8)
// note that some coefs have been removed to make it easier for sqrt-lasso
xtset id
rlasso lrprice larea lintst y81ldist, rob `opt' fe
savedresults save nostd e()
rlasso lrprice larea lintst y81ldist, prestd rob `opt' fe
savedresults comp nostd e(), exclude(macro: cmdline scalar: niter matrix: Psi) tol(1e-8)
xtset id
rlasso lrprice larea lintst y81ldist, rob `opt' fe pnotpen(larea)
savedresults save nostd e()
rlasso lrprice larea lintst y81ldist, prestd rob `opt' fe pnotpen(larea)
savedresults comp nostd e(), exclude(macro: cmdline scalar: niter matrix: Psi) tol(1e-8)
xtset id
rlasso lrprice larea lintst y81ldist, rob `opt' fe partial(larea)
savedresults save nostd e()
rlasso lrprice larea lintst y81ldist, prestd rob `opt' fe partial(larea)
savedresults comp nostd e(), exclude(macro: cmdline scalar: niter matrix: Psi) tol(1e-8)
}
********************** Misc options **************************
// Confirm these don't crash it and that post-lasso is the same.
// Lasso est may differ because of slightly different lambda.
mat betaOLS = .65128713 , .15561146 , .01297576 , 4.7817721
foreach opt in tolopt(1e-8) tolpsi(1e-3) tolzero(1e-3) ///
maxiter(1000) maxpsiiter(5) ///
lassopsi corrn(3) corrn(0) ///
c(1.05) gamma(0.05) gammad(1) ///
{
di "opt=`opt'"
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, `opt' rob
assert mreldif(betaOLS,e(betaOLS))<1e-8
}
// xdep option - standard lasso
// NB: update of values for lassoutils 1.1.01 8nov2018
// benchmark - homoskedastic, no xdep
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc
mat betaOLS = e(betaOLS)
// xdep, homoskedastic
// uses multiplier bootstrap so set seed for replicability
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, xdep seed(1)
assert mreldif(betaOLS,e(betaOLS))<1e-8
assert reldif(e(lambda0),114.432846013)<1e-8
assert reldif(el(e(beta),1,1),0.571190061895)<1e-8
// benchmark - heteroskedastic, no xdep
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, rob
mat betaOLS = e(betaOLS)
// xdep, heteroskedastic
// uses multiplier bootstrap so set seed for replicability
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, xdep rob seed(1)
assert mreldif(betaOLS,e(betaOLS))<1e-8
assert reldif(e(lambda0),112.94387827)<1e-8
assert reldif(el(e(beta),1,1),0.554928934936)<1e-8
// benchmark - cluster, no xdep
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, cluster(id)
mat betaOLS = e(betaOLS)
// xdep, cluster
// uses multiplier bootstrap so set seed for replicability
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, xdep cluster(id) seed(1)
assert mreldif(betaOLS,e(betaOLS))<1e-8
assert reldif(e(lambda0),108.22341837697)<1e-8
assert reldif(el(e(beta),1,1),0.571588016862)<1e-8
// xdep option - sqrt-lasso
// NB: introduced with update of lassoutils 1.1.01 8nov2018
// benchmark - homoskedastic, no xdep
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, sqrt
mat betaOLS = e(betaOLS)
// xdep, homoskedastic
// uses multiplier bootstrap so set seed for replicability
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, xdep seed(1) sqrt
assert mreldif(betaOLS,e(betaOLS))<1e-8
assert reldif(e(lambda0),57.107312563841)<1e-8
assert reldif(el(e(beta),1,1),0.568200965628)<1e-8
// benchmark - heteroskedastic, no xdep
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, rob sqrt
mat betaOLS = e(betaOLS)
// xdep, heteroskedastic
// uses multiplier bootstrap so set seed for replicability
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, xdep rob seed(1) sqrt
assert mreldif(betaOLS,e(betaOLS))<1e-8
assert reldif(e(lambda0),55.179713611581)<1e-8
assert reldif(el(e(beta),1,1),0.554027632301)<1e-8
// benchmark - cluster, no xdep
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, cluster(id) sqrt
mat betaOLS = e(betaOLS)
// xdep, cluster
// uses multiplier bootstrap so set seed for replicability
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, xdep cluster(id) seed(1) sqrt
assert mreldif(betaOLS,e(betaOLS))<1e-8
assert reldif(e(lambda0),51.922234705643)<1e-8
assert reldif(el(e(beta),1,1),0.571322946179)<1e-8
// supscore option
// uses multiplier bootstrap so set seed for replicability
// update for lassoutils 1.1.01 8nov2018 - now sqrt(n)*L instead of n*L
// set seed for null
set seed 1
gen double ynull=rnormal()
// homoskedastic
rlasso ynull cbd intst lintst y81ldist lintstsq y81nrinc, testonly seed(1)
assert reldif(e(supscore),1.7293626410)<1e-8
assert reldif(e(supscore_p),0.242)<1e-8
assert reldif(e(supscore_cv),2.9020830008)<1e-8
// critical value for gamma=10%
rlasso ynull cbd intst lintst y81ldist lintstsq y81nrinc, testonly ssgamma(0.1) seed(1)
assert reldif(e(supscore_cv),2.63337777980)<1e-8
// heteroskedastic
rlasso ynull cbd intst lintst y81ldist lintstsq y81nrinc, testonly rob seed(1)
assert reldif(e(supscore),1.736085668840)<1e-8
assert reldif(e(supscore_p),0.238)<1e-8
assert reldif(e(supscore_cv),2.9020830008)<1e-8
// clustered
rlasso ynull cbd intst lintst y81ldist lintstsq y81nrinc, testonly cluster(id) seed(1)
assert reldif(e(supscore),1.833764450629)<1e-8
assert reldif(e(supscore_p),0.218)<1e-8
assert reldif(e(supscore_cv),2.9020830008)<1e-8
********************** Prediction *********************
// loop through options
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc
foreach option in "xb" "xb lasso" "xb ols" "resid" "resid lasso" "resid ols" {
cap drop newvar
di "option=`option'"
predict double newvar, `option'
}
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, fe
foreach option in "ue" "e" {
cap drop newvar
di "option=`option'"
predict double newvar, `option'
}
// resids should be mean zero
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc
foreach option in " " "lasso" "ols" {
cap drop resid
predict double resid, resid `option'
qui sum resid, meanonly
assert r(mean)<1e-8
}
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, fe
foreach option in "u" "e" "ue" {
cap drop resid
predict double resid, `option'
qui sum resid, meanonly
assert r(mean)<1e-8
}
// mean of predicted yhat = mean of y
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc
qui sum lrprice, meanonly
local ymean `r(mean)'
foreach option in " " "lasso" "ols" {
cap drop yhat
predict double yhat, xb
qui sum yhat, meanonly
assert r(mean)-`ymean'<1e-8
}
// confirm post-lasso OLS matches regress
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc
local selected `e(selected)'
cap drop xb_rlasso
cap drop resid_rlasso
predict double xb_rlasso, xb ols
predict double resid_rlasso, resid ols
regress lrprice `selected'
cap drop xb_regress
cap drop resid_regress
predict double xb_regress, xb
predict double resid_regress, resid
assert reldif(xb_rlasso,xb_regress) < 1e-6
assert reldif(resid_rlasso,resid_regress) < 1e-6
// confirm post-lasso LSDV matches xtreg,fe
foreach opt in xb u e ue xbu {
cap drop `opt'hat_rlasso
cap drop `opt'hat_xtreg
}
rlasso lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc, fe
local selected `e(selected)'
foreach opt in xb u e ue xbu {
predict double `opt'hat_rlasso, ols `opt'
}
xtreg lrprice `selected', fe
foreach opt in xb u e ue xbu {
predict double `opt'hat_xtreg, `opt'
}
foreach opt in xb u e ue xbu {
di "checking option `opt'
assert reldif(`opt'hat_rlasso, `opt'hat_xtreg) < 1e-6
}
**************** Weights *********************
cap drop one
cap drop wt
gen double one=1
// use a non-integer weight
global wtvar lcbdsq
gen double wt=$wtvar
// assumes no missings for any regressors or dep var
sum wt
replace wt = wt * 1/r(mean)
* Basic estimation with constant and no partialling etc.
* w_c_ vars are centered (demeaned using weighted means)
* and then weighted by the sqrt of the weighting var.
cap drop w_*
* weighted centering (so no intercept)
foreach var of varlist lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc {
qui sum `var' [aw=wt], meanonly
gen double w_c_`var' = (`var'-r(mean))*sqrt(wt)
}
global vlist lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc
global w_c_vlist w_c_lrprice w_c_larea w_c_cbd w_c_intst w_c_lintst w_c_y81ldist w_c_lintstsq w_c_y81nrinc
// disallowed options
cap noi rlasso $vlist [aw=$wtvar], nocons
assert _rc==198
foreach opt in "" "rob" {
// cons automatically partialled out
rlasso $vlist [aw=$wtvar], `opt'
mat b=e(beta)
mat bOLS=e(betaOLS)
rlasso $vlist [aw=$wtvar], prestd `opt'
assert mreldif(e(beta),b)<1e-8
assert mreldif(e(betaOLS),bOLS)<1e-8
// no constant to compare
mat b=b[1,1..colsof(b)-1]
mat bOLS=bOLS[1,1..colsof(bOLS)-1]
// use dm and nocons
rlasso $w_c_vlist, dm nocons `opt'
assert mreldif(e(beta),b)<1e-8
assert mreldif(e(betaOLS),bOLS)<1e-8
}
* Estimation with constant and partial/notpen
cap drop w_*
cap drop c_*
* weighted partialling out of y81nrinc
foreach var of varlist lrprice larea cbd intst lintst y81ldist lintstsq {
qui reg `var' y81nrinc [aw=wt]
predict double c_`var', resid
gen double w_c_`var' = c_`var'*sqrt(wt)
}
global vlist lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc
global w_c_vlist w_c_lrprice w_c_larea w_c_cbd w_c_intst w_c_lintst w_c_y81ldist w_c_lintstsq
foreach opt in "" "rob" {
rlasso $vlist [aw=$wtvar], partial(y81nrinc) `rob'
mat b=e(beta)
mat bOLS=e(betaOLS)
rlasso $vlist [aw=$wtvar], partial(y81nrinc) prestd `rob'
assert mreldif(e(beta),b)<1e-8
assert mreldif(e(betaOLS),bOLS)<1e-8
rlasso $vlist [aw=$wtvar], pnotpen(y81nrinc) `rob'
assert mreldif(e(beta),b)<1e-8
assert mreldif(e(betaOLS),bOLS)<1e-8
rlasso $vlist [aw=$wtvar], pnotpen(y81nrinc) prestd `rob'
assert mreldif(e(beta),b)<1e-8
assert mreldif(e(betaOLS),bOLS)<1e-8
// no constant or partialled-out var to compare
mat b=b[1,1..colsof(b)-2]
mat bOLS=bOLS[1,1..colsof(bOLS)-2]
// use dm and nocons
rlasso $w_c_vlist, dm nocons `rob'
assert mreldif(e(beta),b)<1e-8
assert mreldif(e(betaOLS),bOLS)<1e-8
}
* Fixed effects + partialling-out
* id var created earlier
xtset id
cap drop w_*
cap drop c_*
* weighted partialling out of y81nrinc and FEs
foreach var of varlist lrprice larea cbd intst lintst y81ldist lintstsq {
qui reg `var' y81nrinc i.id [aw=wt]
predict double c_`var', resid
gen double w_c_`var' = c_`var'*sqrt(wt)
}
global vlist lrprice larea cbd intst lintst y81ldist lintstsq y81nrinc
global w_c_vlist w_c_lrprice w_c_larea w_c_cbd w_c_intst w_c_lintst w_c_y81ldist w_c_lintstsq
// disallowed options
cap noi rlasso $vlist [aw=$wtvar], partial(y81nrinc) fe noftools
assert _rc==198
foreach opt in "" "rob" {
rlasso $vlist [aw=$wtvar], partial(y81nrinc) fe `rob'
mat b=e(beta)
mat bOLS=e(betaOLS)
rlasso $vlist [aw=$wtvar], partial(y81nrinc) prestd fe `rob'
assert mreldif(e(beta),b)<1e-8
assert mreldif(e(betaOLS),bOLS)<1e-8
rlasso $vlist [aw=$wtvar], pnotpen(y81nrinc) fe `rob'
assert mreldif(e(beta),b)<1e-8
assert mreldif(e(betaOLS),bOLS)<1e-8
rlasso $vlist [aw=$wtvar], pnotpen(y81nrinc) prestd fe `rob'
assert mreldif(e(beta),b)<1e-8
assert mreldif(e(betaOLS),bOLS)<1e-8
// partial-out FEs by hand
rlasso $vlist i.id [aw=$wtvar], partial(y81nrinc i.id) `rob'
mat bfe=e(beta)
mat bfe=bfe[1,1..2]
mat bfeols=e(betaOLS)
mat bfeols=bfeols[1,1..2]
assert mreldif(bfe,b)<1e-8
assert mreldif(bfeols,bOLS)<1e-8
// no partialled-out var to compare
mat b=b[1,1..colsof(b)-1]
mat bOLS=bOLS[1,1..colsof(bOLS)-1]
rlasso $w_c_vlist, dm nocons `rob'
assert mreldif(e(beta),b)<1e-8
assert mreldif(e(betaOLS),bOLS)<1e-8
}
**************** Misc syntax/options *****************************
// Support for inrange(.) and similar [if] expressions:
rlasso $vlist if inrange(age,50,70)
**************** Panel data with time series ops *****************
use "http://fmwww.bc.edu/ec-p/data/macro/abdata.dta", clear
// FE and noftools options
rlasso ys l(0/3).k l(0/3).n, fe
savedresults save ftools e()
cap noi assert "`e(noftools)'"=="" // will be error if ftools not installed
rlasso ys l(0/3).k l(0/3).n, fe noftools
assert "`e(noftools)'"=="noftools"
savedresults comp ftools e(), exclude(macro: cmdline)
// two-way cluster-robust; order shouldn't matter
rlasso ys l(0/3).k l(0/3).n, fe cluster(id year)
savedresults save twoway e()
rlasso ys l(0/3).k l(0/3).n, fe cluster(year id)
savedresults comp twoway e(), exclude( ///
macro: cmdline loptions clustvar clustvar1 clustvar2 ///
scalar: N_clust1 N_clust2 ///
) tol(1e-8)
// balanced panel
keep if year>=1978 & year<=1982
// cluster-robust with a balanced panel is equivalent to
// HAC with bw=all lags and kernel=truncated (and same rlasso gamma)
// can use gamma(0.1) but HAC with maq theoretically appealing
rlasso n w k ys ///
, rob bw(4) kernel(tru) maq
savedresults save hac e()
rlasso n w k ys ///
, cluster(id)
savedresults comp hac e(), exclude( ///
macro: cmdline robust clustvar kernel ///
scalar: N_clust N_clust1 N_clust2 bw niter ///
) tol(1e-8)
// ******************* COMPLETE *********************** //
log close
//set more on
set rmsg off