{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}E:\MEP\ejercicio 2.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}12 Apr 2017, 19:52:54

{com}. gen lucost=log(ucostp)
{err}ucostp not found
{txt}{search r(111):r(111);}

{com}. gen lucost=log(UCOSTP)

. gen lprodp=log(PRODP)

. gen lcump=log(CUMP)

. twoway (scatter UCOSTP CUMP)
{res}
{com}. twoway (scatter lucost lcump)
{res}
{com}. reg lucost lcump

      {txt}Source {c |}       SS       df       MS              Number of obs ={res}      13
{txt}{hline 13}{char +}{hline 30}           F(  1,    11) ={res}  348.08
    {txt}   Model {char |} {res} 1.84132819     1  1.84132819           {txt}Prob > F      = {res} 0.0000
    {txt}Residual {char |} {res} .058189045    11  .005289913           {txt}R-squared     = {res} 0.9694
{txt}{hline 13}{char +}{hline 30}           Adj R-squared = {res} 0.9666
    {txt}   Total {char |} {res} 1.89951723    12  .158293103           {txt}Root MSE      = {res} .07273

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}      lucost{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}lcump {c |}{col 14}{res}{space 2}-.2716672{col 26}{space 2} .0145612{col 37}{space 1}  -18.66{col 46}{space 3}0.000{col 54}{space 4}-.3037161{col 67}{space 3}-.2396183
{txt}{space 7}_cons {c |}{col 14}{res}{space 2}    1.004{col 26}{space 2} .1173625{col 37}{space 1}    8.55{col 46}{space 3}0.000{col 54}{space 4} .7456867{col 67}{space 3} 1.262313
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{com}. reg lucost lcump lprodp

      {txt}Source {c |}       SS       df       MS              Number of obs ={res}      13
{txt}{hline 13}{char +}{hline 30}           F(  2,    10) ={res}  181.93
    {txt}   Model {char |} {res} 1.84870797     2  .924353986           {txt}Prob > F      = {res} 0.0000
    {txt}Residual {char |} {res} .050809261    10  .005080926           {txt}R-squared     = {res} 0.9733
{txt}{hline 13}{char +}{hline 30}           Adj R-squared = {res} 0.9679
    {txt}   Total {char |} {res} 1.89951723    12  .158293103           {txt}Root MSE      = {res} .07128

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}      lucost{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}lcump {c |}{col 14}{res}{space 2}-.2212861{col 26}{space 2} .0441726{col 37}{space 1}   -5.01{col 46}{space 3}0.001{col 54}{space 4}-.3197088{col 67}{space 3}-.1228635
{txt}{space 6}lprodp {c |}{col 14}{res}{space 2}-.0570034{col 26}{space 2} .0472988{col 37}{space 1}   -1.21{col 46}{space 3}0.256{col 54}{space 4}-.1623917{col 67}{space 3} .0483849
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} 1.008082{col 26}{space 2} .1150707{col 37}{space 1}    8.76{col 46}{space 3}0.000{col 54}{space 4}  .751689{col 67}{space 3} 1.264476
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{com}. clear

. import excel "E:\MEP\Ejercicio 2_3 2017.xls", sheet("Ejercicio 2_3") firstrow
{res}
{com}. gen lnp13=log(PL/PF)

. gen lnp23=log(PK/PF)

. gen lncp3=log(COSTS/PF)

. gen lnkw=log(KWH)

. reg lncp3 lnkw lnp13 lnp23

      {txt}Source {c |}       SS       df       MS              Number of obs ={res}     145
{txt}{hline 13}{char +}{hline 30}           F(  3,   141) ={res}  639.98
    {txt}   Model {char |} {res} 294.667578     3  98.2225259           {txt}Prob > F      = {res} 0.0000
    {txt}Residual {char |} {res} 21.6403212   141  .153477455           {txt}R-squared     = {res} 0.9316
{txt}{hline 13}{char +}{hline 30}           Adj R-squared = {res} 0.9301
    {txt}   Total {char |} {res} 316.307899   144  2.19658263           {txt}Root MSE      = {res} .39176

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}       lncp3{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 8}lnkw {c |}{col 14}{res}{space 2} .7206875{col 26}{space 2} .0174357{col 37}{space 1}   41.33{col 46}{space 3}0.000{col 54}{space 4} .6862183{col 67}{space 3} .7551567
{txt}{space 7}lnp13 {c |}{col 14}{res}{space 2} .5929097{col 26}{space 2} .2045722{col 37}{space 1}    2.90{col 46}{space 3}0.004{col 54}{space 4} .1884845{col 67}{space 3} .9973349
{txt}{space 7}lnp23 {c |}{col 14}{res}{space 2} -.007381{col 26}{space 2} .1907356{col 37}{space 1}   -0.04{col 46}{space 3}0.969{col 54}{space 4}-.3844522{col 67}{space 3} .3696901
{txt}{space 7}_cons {c |}{col 14}{res}{space 2}-4.690789{col 26}{space 2} .8848714{col 37}{space 1}   -5.30{col 46}{space 3}0.000{col 54}{space 4}-6.440119{col 67}{space 3}-2.941459
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{com}. test lnkw=1

{p 0 7}{space 1}{text:( 1)}{space 1} {res}lnkw = 1{p_end}

{txt}       F(  1,   141) ={res}  256.63
{txt}{col 13}Prob > F ={res}    0.0000

{com}. help postest

. predict rescost, resid

. predict costhat, predict
{err}option predict not allowed
{txt}{search r(198):r(198);}

{com}. help predict

. predict costhat, xb

. twoway (scatter lnkw rescost)
{res}
{com}. twoway (scatter rescost lnkw)
{res}
{com}. ttest lnkw=1

{txt}One-sample t test
{hline 9}{c TT}{hline 68}
Variable{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
    lnkw {c |}{res}{col 12}    145{col 22} 6.556651{col 34} .1588488{col 46} 1.912792{col 58} 6.242675{col 70} 6.870628
{txt}{hline 9}{c BT}{hline 68}
    mean = mean({res}lnkw{txt})                                             t = {res} 34.9808
{txt}Ho: mean = {res}1                                     {txt}degrees of freedom = {res}     144

    {txt}Ha: mean < {res}1                 {txt}Ha: mean != {res}1                 {txt}Ha: mean > {res}1
 {txt}Pr(T < t) = {res}1.0000         {txt}Pr(|T| > |t|) = {res}0.0000          {txt}Pr(T > t) = {res}0.0000

{com}. reg lncp3 lnkw lnp13 lnp23

      {txt}Source {c |}       SS       df       MS              Number of obs ={res}     145
{txt}{hline 13}{char +}{hline 30}           F(  3,   141) ={res}  639.98
    {txt}   Model {char |} {res} 294.667578     3  98.2225259           {txt}Prob > F      = {res} 0.0000
    {txt}Residual {char |} {res} 21.6403212   141  .153477455           {txt}R-squared     = {res} 0.9316
{txt}{hline 13}{char +}{hline 30}           Adj R-squared = {res} 0.9301
    {txt}   Total {char |} {res} 316.307899   144  2.19658263           {txt}Root MSE      = {res} .39176

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}       lncp3{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 8}lnkw {c |}{col 14}{res}{space 2} .7206875{col 26}{space 2} .0174357{col 37}{space 1}   41.33{col 46}{space 3}0.000{col 54}{space 4} .6862183{col 67}{space 3} .7551567
{txt}{space 7}lnp13 {c |}{col 14}{res}{space 2} .5929097{col 26}{space 2} .2045722{col 37}{space 1}    2.90{col 46}{space 3}0.004{col 54}{space 4} .1884845{col 67}{space 3} .9973349
{txt}{space 7}lnp23 {c |}{col 14}{res}{space 2} -.007381{col 26}{space 2} .1907356{col 37}{space 1}   -0.04{col 46}{space 3}0.969{col 54}{space 4}-.3844522{col 67}{space 3} .3696901
{txt}{space 7}_cons {c |}{col 14}{res}{space 2}-4.690789{col 26}{space 2} .8848714{col 37}{space 1}   -5.30{col 46}{space 3}0.000{col 54}{space 4}-6.440119{col 67}{space 3}-2.941459
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{com}. ttest lnkw=1

{txt}One-sample t test
{hline 9}{c TT}{hline 68}
Variable{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
    lnkw {c |}{res}{col 12}    145{col 22} 6.556651{col 34} .1588488{col 46} 1.912792{col 58} 6.242675{col 70} 6.870628
{txt}{hline 9}{c BT}{hline 68}
    mean = mean({res}lnkw{txt})                                             t = {res} 34.9808
{txt}Ho: mean = {res}1                                     {txt}degrees of freedom = {res}     144

    {txt}Ha: mean < {res}1                 {txt}Ha: mean != {res}1                 {txt}Ha: mean > {res}1
 {txt}Pr(T < t) = {res}1.0000         {txt}Pr(|T| > |t|) = {res}0.0000          {txt}Pr(T > t) = {res}0.0000

{com}. exit, clear
