Announcement

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

  • Visualise interaction with standardized variables

    Dear colleagues,

    I have trouble visualising an interaction once I standardize variables.

    Specifically, I have a first model that looks like that:
    Code:
    mixed UMOD24hsqrt c.copeptinlog##c.UVOLlog agesqrt sex01 diabetes ckd_epi d_diur kid_vollog center || treenbr:
    .

    The result of the model is:
    HTML Code:
      	 		 			  			  			  		 		 			UMOD24hsqrt 			Coefficient 			Std. err. 			z 			P>z 			[95% conf. 			interval] 		 		 			  			  			  		 		 			copeptinlog 			-74.88356 			39.12374 			-1.91 			0.056 			-151.5647 			1.797554 		 		 			UVOLlog 			24.73341 			8.459611 			2.92 			0.003 			8.15288 			41.31394 		 		 			  		 		 			c.copeptinlog#c.UVOLlog 			9.978583 			5.307806 			1.88 			0.060 			-.4245261 			20.38169 		 		 			  		 		 			agesqrt 			-1.181372 			1.703502 			-0.69 			0.488 			-4.520175 			2.15743 		 		 			sex01 			-6.07121 			3.538691 			-1.72 			0.086 			-13.00692 			.8644978 		 		 			diabetes 			-29.19046 			6.985046 			-4.18 			0.000 			-42.8809 			-15.50002 		 		 			ckd_epi 			.4720325 			.1281877 			3.68 			0.000 			.2207891 			.7232759 		 		 			d_diur 			10.00236 			6.541349 			1.53 			0.126 			-2.818452 			22.82316 		 		 			kid_vollog 			22.16283 			6.505935 			3.41 			0.001 			9.411431 			34.91423 		 		 			center 			3.553909 			2.681327 			1.33 			0.185 			-1.701395 			8.809213 		 		 			_cons 			-122.7101 			69.43573 			-1.77 			0.077 			-258.8016 			13.38146
    Then I have this code to display a graph showing the interaction effect:
    Code:
    sum UVOLlog
    global UVOLlow=r(mean)-r(sd)
    global UVOLmed=r(mean)
    global UVOLhigh=r(mean)+r(sd)
    margins, at(copeptinlog=(-1(0.5)5) UVOLlog=($UVOLlow $UVOLmed $UVOLhigh))
    marginsplot, xlabel (-1(0.5)5)
    The graph shows like this:

    graph 1.gph


    Then I standardized the variables as well as the interaction term:
    Code:
    egen UOSMstd=std(UOSMmeasuredsqrt)
    egen UMODstd=std(UMOD24hsqrt)
    egen copeptinstd=std(copeptinlog)
    egen UVOLstd=std(UVOLlog)
    egen agestd=std(agesqrt)
    egen ckdepistd=std(ckd_epi)
    egen kidvolstd=std(kid_vollog)
    egen interaction=std(c.copeptinlog#c.UVOLlog)
    The model is then:
    Code:
    mixed UMODstd copeptinstd UVOLstd interaction agestd sex01 diabetes ckdepistd d_diur kidvolstd center || treenbr:
    The results are as follows:
    HTML Code:
      	 		 			UMODstd 			Coefficient 			Std. err. 			z 			P>z 			[95% conf. 			interval] 		 		 			  			  			  		 		 			copeptinstd 			-.883209 			.4614423 			-1.91 			0.056 			-1.787619 			.0212013 		 		 			UVOLstd 			.2042191 			.0698494 			2.92 			0.003 			.0673168 			.3411213 		 		 			interaction 			.826012 			.4393723 			1.88 			0.060 			-.0351418 			1.687166 		 		 			agestd 			-.0287521 			.0414596 			-0.69 			0.488 			-.1100114 			.0525073 		 		 			sex01 			-.1125218 			.0655849 			-1.72 			0.086 			-.2410659 			.0160223 		 		 			diabetes 			-.5410063 			.1294585 			-4.18 			0.000 			-.7947404 			-.2872723 		 		 			ckdepistd 			.1559156 			.0423413 			3.68 			0.000 			.0729282 			.2389031 		 		 			d_diur 			.1853803 			.1212352 			1.53 			0.126 			-.0522363 			.4229969 		 		 			kidvolstd 			.1139403 			.0334474 			3.41 			0.001 			.0483847 			.1794959 		 		 			center 			.065867 			.0496949 			1.33 			0.185 			-.0315332 			.1632671 		 		 			_cons 			.0181989 			.0728123 			0.25 			0.803 			-.1245106 			.1609083
    So everything seems correct here with same z and p values.

    The code for the graph is then:
    Code:
    margins, at(copeptinstd=(-2(1)2) UVOLstd=(-2(1)2))
    marginsplot, xlabel (-2(1)2)
    However when I print the graph:
    Graph 2.gph


    Interacting effect seems gone. Obviously, standardising the variables is preventing visualisation of the interaction but I am not sure I understand why... Is there something conceptually wrong about that approach?

    Thank you very much++

    David JAQUES
Working...
X