I'm using mixed in Stata 15.1 to analyze a change in my variables at two time points. The data were generated in a randomized controlled medical study.
I am using these commands:
Although I'm paying close attention to the magnitude of the average marginal effect and the confidence intervals generated, I'm required to report p-values. In previous posts, Stata forum guides have suggested that if the p-values found 1) on the interaction term are quite different than 2) those generated by the margins, dydx command, some additional thought is required about what may be going on in the data.
My understanding is margins, dydx(var) generates a partial derivative with respect to var, measuring change in one variable while the others are held at their observed values.
Question1: Previous posts warned against relying on p-values from average adjusted predictions generated by margins. Is this also true of average marginal effects?
Question2: Could you please help me understand why certain variables (like "small" and "large" in my sample data) are significant by p-value on the interaction term (full derivative) but not in the margins command (partial derivative)? What can I learn about my data from these results?
A sample of my data is included below. Thank you in advance for your help and patience with my questions.
I am using these commands:
Code:
mixed small i.trt##i.time || id:, vce(robust) margins, dydx(trt)
My understanding is margins, dydx(var) generates a partial derivative with respect to var, measuring change in one variable while the others are held at their observed values.
Question1: Previous posts warned against relying on p-values from average adjusted predictions generated by margins. Is this also true of average marginal effects?
Question2: Could you please help me understand why certain variables (like "small" and "large" in my sample data) are significant by p-value on the interaction term (full derivative) but not in the margins command (partial derivative)? What can I learn about my data from these results?
A sample of my data is included below. Thank you in advance for your help and patience with my questions.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int id byte trt float(time small large) 1001 1 0 103.62028 2057.409 1001 1 2 83.89479 1673.689 1002 2 0 53.92493 1494.9586 1002 2 2 47.69698 1342.497 1003 1 0 95.35509 1537.0225 1003 1 2 74.401726 1095.4296 1004 2 0 61.61027 1367.5326 1004 2 2 49.44355 1145.2207 1005 2 0 94.76392 2612.909 1005 2 2 51.50049 1128.3427 1006 1 0 86.49782 1456.245 1006 1 2 65.66128 1411.7137 1007 2 0 121.33897 2947.7104 1007 2 2 101.6294 2035.673 1008 1 0 91.95323 1224.9602 1008 1 2 79.91485 1342.048 1010 2 0 78.80621 2073.3826 1010 2 2 62.52343 1607.94 1012 1 0 84.50602 1766.792 1012 1 2 86.0701 1849.264 1013 1 0 62.16099 1512.2836 1013 1 2 97.44263 1719.307 1015 2 0 83.27814 1706.0673 1015 2 2 60.52657 933.7055 1016 2 0 64.726036 1280.3625 1016 2 2 40.03102 733.2215 1017 2 0 104.22501 1412.9833 1017 2 2 81.8728 1217.6375 1018 2 0 81.716 1719.5686 1018 2 2 68.464676 1478.304 1020 2 0 143.5548 2186.3103 1020 2 2 140.04892 1548.019 1021 1 0 107.65491 2073.9907 1021 1 2 . . 1022 1 0 76.36583 1707.781 1022 1 2 65.04529 1766.207 1023 2 0 57.13372 996.4772 1023 2 2 52.33152 905.7919 1024 1 0 61.39893 1060.22 1024 1 2 56.26431 802.0148 1025 1 0 127.1972 2630.19 1025 1 2 . . 1026 2 0 79.88757 1726.9504 1026 2 2 54.34812 1155.5836 1027 1 0 60.56401 1684.059 1027 1 2 85.44836 2059.1775 1028 2 0 78.68946 1698.101 1028 2 2 66.658676 1222.4415 1029 2 0 97.76624 1751.821 1029 2 2 98.43185 1980.2466 end label values trt diet_lab label def diet_lab 1 "Treat1", modify label def diet_lab 2 "Treat2", modify label values time visitlab label def visitlab 0 "Baseline", modify label def visitlab 2 "6 Mos", modify label var id "ID" label var trt "Treatment" label var time "Time" label var small "Small" label var large "Large"
Comment