Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Test significance of a coefficient from a linear regression model

    Dear Statalist members,

    I am running a linear regression model which is specification based on a Cobb-Douglas production function for agricultural producers. My aim is to estimate the elasticities of productivity with respect to each factor of production. I have interaction terms in my specification which allow for the link between type of agricultural season and type of soil on which the producers crop. In the data one can clearly see that there is an interdependence between the type of soil, the type of season and type of crop that has been produced. For example, I have considerably more observations of type of soil 1 in the rainy season than in the not rainy season. This I show with standard frequency tables. The problem is that when I want to report the elasticity of ln(productivity) with respect to ln(capital per hectare) I have to take account of this interdependence and estimate eventually a weighted average elascticity coefficient based on the prob. of each type of soil per season and per crop. I split the sample only into tomato and no tomato producers, so the estimation of these probabilities is not very complicated. Each probability is generated as a separate variable which is like a constant since there is only one value for it.

    I managed to estimate the weighted average elasticity coefficients, but when it comes to test their significance in Stata I cannot perform the ‘test’ command when I multiply the regression coefficients by the respective probabilities. I think that I should directly write the numbers in the formula rather than referring to the variable for the probability. I would at this point be very very grateful if you can give me advice how I can still report F-stat. and p-values for those weighted average coefficients in the easiest possible way. Below I show you the regression specification, the generated coefficients and the test for significance. I am using Stata 14.

    Thank you very much in advance for your help!

    Albena


    Code:
    reg lproductivity lplot lcapital_cost_ha ltotal_labourha lq_seedsha alphabet female t_soil2 t_soil3 lcapital_cost_ha_rain lq_seedsha_rain ltotal_labourha_rain lcapital_cost_harainysoil2 lcapital_cost_harainysoil3 lcapital_cost_hasoil2 lcapital_cost_hasoil3 lq_seedsharainysoil2 lq_seedsharainysoil3 lq_seedshasoil2 lq_seedshasoil3 ltotal_labourharainysoil2 ltotal_labourharainysoil3 ltotal_labourhasoil2 ltotal_labourhasoil3 rainyseason, cluster(vill_nexpl)
    
    gen capital_rainy = sharess1r1tom0*(_b[lcapital_cost_ha] + _b[lcapital_cost_ha_rain]) + sharess2r1tom0*(_b[lcapital_cost_harainysoil2] + _b[lcapital_cost_hasoil2]) + sharess3r1tom0*(_b[lcapital_cost_harainysoil3] + _b[lcapital_cost_hasoil3])
    
    test sharess1r1tom0*(_b[lcapital_cost_ha] + _b[lcapital_cost_ha_rain]) + sharess2r1tom0*(_b[lcapital_cost_harainysoil2] + _b[lcapital_cost_hasoil2]) + sharess3r1tom0*(_b[lcapital_cost_harainysoil3] + _b[lcapital_cost_hasoil3])
    gen P7=r(p)
    gen F7= r(F)
    
    gen capital_nrainy = sharess1r0tom0*_b[lcapital_cost_ha] + sharess2r0tom0*_b[lcapital_cost_hasoil2] + sharess3r0tom0*_b[lcapital_cost_hasoil3]
    
    test sharess1r0tom0*_b[lcapital_cost_ha] + sharess2r0tom0*_b[lcapital_cost_hasoil2] + sharess3r0tom0*_b[lcapital_cost_hasoil3]
    gen P8=r(p)
    gen F8= r(F)
    
    gen capital_tot= sharer1t0*(shares1t0*(_b[lcapital_cost_ha] + _b[lcapital_cost_ha_rain]) + shares2t0*(_b[lcapital_cost_harainysoil2] + _b[lcapital_cost_hasoil2]) + shares3t0*(_b[lcapital_cost_harainysoil3] + _b[lcapital_cost_hasoil3])) + sharer0t0*(shares1t0*_b[lcapital_cost_ha] + shares2t0*_b[lcapital_cost_hasoil2] + shares3t0*_b[lcapital_cost_hasoil3])
    
    test sharer1t0*(sharess1r1tom0*(_b[lcapital_cost_ha] + _b[lcapital_cost_ha_rain]) + sharess2r1tom0*(_b[lcapital_cost_harainysoil2] + _b[lcapital_cost_hasoil2]) + sharess3r1tom0*(_b[lcapital_cost_harainysoil3] + _b[lcapital_cost_hasoil3])) + sharer0t0*(sharess1r0tom0*_b[lcapital_cost_ha] + sharess2r0tom0*_b[lcapital_cost_hasoil2] + sharess3r0tom0*_b[lcapital_cost_hasoil3])  
    gen P25=r(p)
    gen F25=r(F)

  • #2
    First, you should specify the interaction terms using the # operator, rather than generating variables that are interactions. This will help down-the-road, since Stata's "test" command will know they are interactions.

    Once you have done that, you should be able to use the "test" command in a straightforward manner, or the "nlcom" command if you want to test a nonlinear combination of parameters. Stata will take account of all the interactions if you used the # operator.
    Last edited by Jimmy Squibb; 16 Mar 2017, 13:46.

    Comment

    Working...
    X