Hi All,
Is there a way to include factor variables and interaction terms in Boxcox estimation?
I tried with the code below but it keeps giving me the error "interaction term not allowed" and "factor variable not allowed"
boxcox Pn Pl Pk c.Pn#c.Pk c.Pn#c.t c.Pl#c.t c.Pk#c.t, nontrans(t t2 i.tt#i.frr) model(lambda) lrtest
An example of my data set is also below.
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input double(Pn Pl Pk) float(t t2 frr tt) double Q
.0609785078763391 .017650253807106598 .162055149710988 1 .5 9 1 1918755.28016959
.0626971032380077 .013000101522842639 .15737462226352 2 2 9 1 1951522.53201142
.0650912944661291 .015996598984771574 .16161486770767 3 4.5 9 1 1897272.35519421
.0676199423195572 .01595223350253807 .162219040723409 4 8 9 1 2128731.72691168
.0698664035680801 .021630456852791878 .172586234786627 5 12.5 9 1 2137339.06392922
.0736426453861825 .022721573604060914 .174582122512778 6 18 9 2 2248955.81168943
.0794277644086213 .03219380710659898 .185314792685851 7 24.5 9 2 2113757.14805628
.0863408283135735 .04094406091370558 .190026059484363 8 32 9 2 2034704.23781833
.0933709817121125 .05920279187817259 .205978655349773 9 40.5 9 2 2099575.54158303
.102632813437591 .07592251269035533 .219316778652586 10 50 9 2 2217404.14999201
.109117983583369 .1059738578680203 .242251337581889 11 60.5 9 3 2204675.4013638
.113292429624622 .11648553299492385 .252959366563067 12 72 9 3 2453768.70117035
.119798894508631 .12748791878172588 .26360346869302 13 84.5 9 3 2432876.05402815
.131144911212364 .16637827411167513 .289323815584869 14 98 9 4 2348257.05892373
.143590653760572 .19793238578680203 .329897389705303 15 112.5 9 4 2406711.11977982
.161360333460557 .12980426395939088 .303414754111234 16 128 9 4 2527523.75593694
.179900781826096 .0908455076142132 .303239300513947 17 144.5 9 4 2592491.08445647
.168453929368807 .24884779187817258 .373515816185215 18 162 9 5 2481799.02031462
.24379006423608 .29164890862944165 .407418053735516 19 180.5 9 5 2600174.11190934
.243551684191016 .34468578680203044 .464844034939839 20 200 9 5 2731638.87137935
.211964965018005 .47842192893401014 .556210375089252 21 220.5 9 5 2493861.48650915
.244605914114094 .7248902284263959 .679362511018155 22 242 9 6 2966652.81931648
.285544306976579 .8172539086294416 .73653161724752 23 264.5 9 6 2870201.66734761
.283421691677214 .9490043908629442 .810575715981334 24 288 9 6 2577686.17519827
.287172638866526 1.0748762182741116 .884422205197822 25 312.5 9 6 2728603.58359605
.34085502170312 .9563667005076142 .873243380189252 26 338 9 7 2866771.11490988
.426936533544043 .7353624365482233 .813986792004589 27 364.5 9 7 2637546.79374308
.408627916076957 .6941327411167513 .823541316580041 28 392 9 7 2955628.59710209
.359541290510045 .6994026395939086 .871323588764479 29 420.5 9 7 3049593.12618372
.46001474387067 .6937501776649746 .901244293210722 30 450 9 7 3091459.06286612
.56529821794285 .7345431472081218 .92160693069365 31 480.5 9 8 3190312.28871947
.494397672099096 .7376515736040609 .921092627691804 32 512 9 8 3540452.01408182
.400149137965126 .7392270304568528 .915109480199523 33 544.5 9 8 3356513.77600942
.598847479125847 .7830727918781726 .933486960778561 34 578 9 8 3192742.26665382
.689390251562301 .8356486294416243 .969060684494065 35 612.5 9 8 3438892.22604856
.803594736571673 1.0849559390862944 1.0175790062936 38 722 9 9 3516993.01270911
.788265922050836 1.0718293147208122 1.02707739004091 39 760.5 9 9 3545227.13347065
.69026861633013 1.216454263959391 1.08686932111289 40 800 9 9 3785301.14233901
.857643633073753 1.3247558375634518 1.14965329701246 41 840.5 9 9 3620191.61255539
.866258690504022 1.2451635532994925 1.13829420025425 42 882 9 9 3835803.67553315
.791578228890215 1.125768426395939 1.09749293242883 43 924.5 9 10 3751696.24380636
.819240624483743 1.1013903045685278 1.09843555013846 44 968 9 10 4050607.64744369
1.04004964692199 .9508955583756346 1.08039979131912 45 1012.5 9 10 3934831.28754188
.06446998968204754 .026456099854461942 .1649063539534381 1 .5 8 1 2060017.642153007
.06586121870012875 .02042605117885853 .1609466873218907 2 2 8 1 2221127.3605494276
.06801114543970262 .026578580343486362 .1652279929566308 3 4.5 8 1 2278766.310172389
.07021757472845325 .02800998829428944 .1661024954862489 4 8 8 1 2409175.5725045493
.0726035418965722 .040160672278023765 .1767369793802374 5 12.5 8 1 2544808.363526034
Thanks,
Francis.
Is there a way to include factor variables and interaction terms in Boxcox estimation?
I tried with the code below but it keeps giving me the error "interaction term not allowed" and "factor variable not allowed"
boxcox Pn Pl Pk c.Pn#c.Pk c.Pn#c.t c.Pl#c.t c.Pk#c.t, nontrans(t t2 i.tt#i.frr) model(lambda) lrtest
An example of my data set is also below.
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input double(Pn Pl Pk) float(t t2 frr tt) double Q
.0609785078763391 .017650253807106598 .162055149710988 1 .5 9 1 1918755.28016959
.0626971032380077 .013000101522842639 .15737462226352 2 2 9 1 1951522.53201142
.0650912944661291 .015996598984771574 .16161486770767 3 4.5 9 1 1897272.35519421
.0676199423195572 .01595223350253807 .162219040723409 4 8 9 1 2128731.72691168
.0698664035680801 .021630456852791878 .172586234786627 5 12.5 9 1 2137339.06392922
.0736426453861825 .022721573604060914 .174582122512778 6 18 9 2 2248955.81168943
.0794277644086213 .03219380710659898 .185314792685851 7 24.5 9 2 2113757.14805628
.0863408283135735 .04094406091370558 .190026059484363 8 32 9 2 2034704.23781833
.0933709817121125 .05920279187817259 .205978655349773 9 40.5 9 2 2099575.54158303
.102632813437591 .07592251269035533 .219316778652586 10 50 9 2 2217404.14999201
.109117983583369 .1059738578680203 .242251337581889 11 60.5 9 3 2204675.4013638
.113292429624622 .11648553299492385 .252959366563067 12 72 9 3 2453768.70117035
.119798894508631 .12748791878172588 .26360346869302 13 84.5 9 3 2432876.05402815
.131144911212364 .16637827411167513 .289323815584869 14 98 9 4 2348257.05892373
.143590653760572 .19793238578680203 .329897389705303 15 112.5 9 4 2406711.11977982
.161360333460557 .12980426395939088 .303414754111234 16 128 9 4 2527523.75593694
.179900781826096 .0908455076142132 .303239300513947 17 144.5 9 4 2592491.08445647
.168453929368807 .24884779187817258 .373515816185215 18 162 9 5 2481799.02031462
.24379006423608 .29164890862944165 .407418053735516 19 180.5 9 5 2600174.11190934
.243551684191016 .34468578680203044 .464844034939839 20 200 9 5 2731638.87137935
.211964965018005 .47842192893401014 .556210375089252 21 220.5 9 5 2493861.48650915
.244605914114094 .7248902284263959 .679362511018155 22 242 9 6 2966652.81931648
.285544306976579 .8172539086294416 .73653161724752 23 264.5 9 6 2870201.66734761
.283421691677214 .9490043908629442 .810575715981334 24 288 9 6 2577686.17519827
.287172638866526 1.0748762182741116 .884422205197822 25 312.5 9 6 2728603.58359605
.34085502170312 .9563667005076142 .873243380189252 26 338 9 7 2866771.11490988
.426936533544043 .7353624365482233 .813986792004589 27 364.5 9 7 2637546.79374308
.408627916076957 .6941327411167513 .823541316580041 28 392 9 7 2955628.59710209
.359541290510045 .6994026395939086 .871323588764479 29 420.5 9 7 3049593.12618372
.46001474387067 .6937501776649746 .901244293210722 30 450 9 7 3091459.06286612
.56529821794285 .7345431472081218 .92160693069365 31 480.5 9 8 3190312.28871947
.494397672099096 .7376515736040609 .921092627691804 32 512 9 8 3540452.01408182
.400149137965126 .7392270304568528 .915109480199523 33 544.5 9 8 3356513.77600942
.598847479125847 .7830727918781726 .933486960778561 34 578 9 8 3192742.26665382
.689390251562301 .8356486294416243 .969060684494065 35 612.5 9 8 3438892.22604856
.803594736571673 1.0849559390862944 1.0175790062936 38 722 9 9 3516993.01270911
.788265922050836 1.0718293147208122 1.02707739004091 39 760.5 9 9 3545227.13347065
.69026861633013 1.216454263959391 1.08686932111289 40 800 9 9 3785301.14233901
.857643633073753 1.3247558375634518 1.14965329701246 41 840.5 9 9 3620191.61255539
.866258690504022 1.2451635532994925 1.13829420025425 42 882 9 9 3835803.67553315
.791578228890215 1.125768426395939 1.09749293242883 43 924.5 9 10 3751696.24380636
.819240624483743 1.1013903045685278 1.09843555013846 44 968 9 10 4050607.64744369
1.04004964692199 .9508955583756346 1.08039979131912 45 1012.5 9 10 3934831.28754188
.06446998968204754 .026456099854461942 .1649063539534381 1 .5 8 1 2060017.642153007
.06586121870012875 .02042605117885853 .1609466873218907 2 2 8 1 2221127.3605494276
.06801114543970262 .026578580343486362 .1652279929566308 3 4.5 8 1 2278766.310172389
.07021757472845325 .02800998829428944 .1661024954862489 4 8 8 1 2409175.5725045493
.0726035418965722 .040160672278023765 .1767369793802374 5 12.5 8 1 2544808.363526034
Thanks,
Francis.
Comment