I am trying to calculate the marginal effect of an interaction term of a glm model, fam (bin) link (logit).
The marginal effect, p-value and se of the interaction term obtained with this command :
are equal to -0.0638* (se=0.0288)
If I get correctly what is discussed and explained here :
https://www.stata.com/support/faqs/s...-interactions/
I should calculate the marginal effect of my interaction term as follow:
In order to get the p-value I have tried the follow:
Is that correct?
Can anyone clarify how I can calculate the p-value?
Thanks
Federica
The marginal effect, p-value and se of the interaction term obtained with this command :
Code:
margins, dydx(*)
If I get correctly what is discussed and explained here :
https://www.stata.com/support/faqs/s...-interactions/
I should calculate the marginal effect of my interaction term as follow:
Code:
sysuse auto, clear (1978 Automobile Data) set seed 12345 generate dum=uniform()>0.5 table dum ---------------------- dum | Freq. ----------+----------- 0 | 37 1 | 37 ---------------------- generate td=turn*dum probit foreign turn dum td, nolog Probit estimates Number of obs = 74 LR chi2(3) = 40.64 Prob > chi2 = 0.0000 Log likelihood = -24.712342 Pseudo R2 = 0.4512 ------------------------------------------------------------------------------ foreign | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- turn | -.4162473 .1256398 -3.31 0.001 -.6624968 -.1699978 dum | -6.545885 5.52614 -1.18 0.236 -17.37692 4.285149 td | .1644299 .1498474 1.10 0.273 -.1292656 .4581253 _cons | 15.41459 4.641172 3.32 0.001 6.318063 24.51112 ------------------------------------------------------------------------------ quietly summarize turn if e(sample) local meantur= r(mean) . quietly summarize dum if e(sample) local meandum = r(mean) local xb _b[turn]*`meantur' + _b[dum]*`meandum' + _b[td]*`meantur'*`meandum' + _b[_cons] predictnl dydt = normalden(`xb')*(_b[turn] + _b[td]*`meandum') in 1, se(set) list dydt set in 1 +----------------------+ | dydt set | |----------------------| 1. | -.0725871 .0163552 | +----------------------+ local xb1 _b[turn]*`meantur' + _b[dum]*1 + _b[td]*`meantur'*1 + _b[_cons] local xb0 _b[turn]*`meantur' + _b[dum]*0+ _b[td]*`meantur'*0 + _b[_cons] predictnl dydd = normal(`xb1')-normal(`xb0') in 1, se(sed) list dydd sed in 1 +----------------------+ | dydd sed | |----------------------| 1. | -.0057505 .1292351 | +----------------------+ predictnl dyddt =normalden(`xb1')*(_b[turn] + _b[td]) - normalden(`xb0')*(_b[turn]) in 1, se(sedt) list dyddt sedt in 1 +---------------------+ | dyddt sedt | |---------------------| 1. | .0378494 .0348098 | +---------------------+
predictnl dyddt =normalden(`xb1')*(_b[turn] + _b[td]) - normalden(`xb0')*(_b[turn]) in 1, se(sedt) p(pval)
Can anyone clarify how I can calculate the p-value?
Thanks
Federica
Comment