Hi guys,
I thought I would make a slick graph for my interaction effect for 2 continous variables.
dataex :
. dataex MsciUsa_TotReturnIndex real_month exhibit_force exhibit_force_event reduce_relations reduce_relations_event
----------------------- copy starting from the next line -----------------------
------------------ copy up to and including the previous line ------------------
Listed 100 out of 240 observations
Use the count() option to list more
error:
. // add vce(unconditional) to include standard errors appropriate for population inferences:
. quietly margins, at(exhibit_force=(0(20)180) reduce_relations=(0(60)600)) saving(predictions,replace)
variable 'reduce_relations' not found in list of covariates
r(322);
thus this error gives expected outputs for reduce_relations.
unsure how to proceed.
exhibit_force ranges from 1 to 161
reduce relation from 4 to 606.
Q:
- how to get stata to found reduce_relations in my list of covariates
- are the effects of omiting observations for 161 exhibting force and 601 602 603 604 605 in reduce_relations negligible, if goal is to show presence interaction effect.
thank you
I thought I would make a slick graph for my interaction effect for 2 continous variables.
dataex :
. dataex MsciUsa_TotReturnIndex real_month exhibit_force exhibit_force_event reduce_relations reduce_relations_event
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double MsciUsa_TotReturnIndex float real_month long exhibit_force double exhibit_force_event long reduce_relations double reduce_relations_event 1158.852 408 3 11 11 27 1201.082 409 4 8 21 58 1167.437 410 14 38 28 67 1117.015 411 7 15 15 37 1133.025 412 3 4 11 29 1152.004 413 3 7 30 67 1119.778 414 7 15 15 28 1157.778 415 8 20 18 44 1203.548 416 12 40 22 51 1178.293 417 42 130 30 63 1205.588 418 6 10 7 16 1164.663 419 6 11 8 19 1182.011 420 2 3 19 37 1214.883 421 3 8 25 55 1263.074 422 8 14 29 70 1297.222 423 3 3 15 34 1338.256 424 8 16 15 34 1390.833 425 1 2 20 43 1425.372 426 6 13 22 44 1474.114 427 2 4 22 46 1474.553 428 6 15 9 19 1541.034 429 3 5 11 18 1540.647 430 4 5 22 61 1608.724 431 2 4 13 26 1633.386 432 5 8 15 29 1692.017 433 14 37 34 75 1709.998 434 13 22 36 66 1727.687 435 11 23 44 123 1753.61 436 4 6 40 97 1800.809 437 11 23 41 86 1811.811 438 23 45 49 90 1732.479 439 14 33 51 111 1771.655 440 41 94 34 61 1871.283 441 8 16 40 92 1919.512 442 6 9 35 69 2064.995 443 10 22 35 66 2026.293 444 3 5 25 44 2165.497 445 7 14 19 34 2181.224 446 7 11 47 126 2084.009 447 10 18 43 79 2221.712 448 1 1 36 88 2347.995 449 7 12 57 123 2455.442 450 8 13 24 47 2650.06 451 7 12 32 66 2493.214 452 3 7 33 60 2623.869 453 10 26 36 70 2552.82 454 10 15 56 130 2676.92 455 12 20 43 81 2716.982 456 7 14 41 112 2752.48 457 22 39 36 60 2946.083 458 12 21 56 108 3099.36 459 7 16 34 72 3136.193 460 16 29 96 262 3073.75 461 6 11 65 158 3206.355 462 13 23 33 77 3175.11 463 22 59 56 119 2733.618 464 14 30 34 66 2913.732 465 7 14 37 72 3139.696 466 24 46 56 124 3353.374 467 21 50 55 123 3551.723 468 26 61 55 109 3705.311 469 16 28 51 94 3601.942 470 10 22 63 197 3751.828 471 24 42 55 108 3887.652 472 18 38 40 89 3797.28 473 19 31 43 83 4001.631 474 13 27 47 101 3872.025 475 17 44 45 86 3847.674 476 18 39 71 153 3733.527 477 22 47 61 124 3977.809 478 12 21 66 133 4063.205 479 12 27 56 134 4346.659 480 7 12 52 121 4113.942 481 10 20 39 88 4016.239 482 14 37 48 122 4417.244 483 11 23 51 118 4274.448 484 14 39 39 81 4161.501 485 10 31 59 132 4261.432 486 6 13 36 87 4185.351 487 8 13 46 92 4403.062 488 7 15 39 71 4163.637 489 17 54 42 112 4134.069 490 5 9 43 88 3807.643 491 3 5 32 72 3801.778 492 8 15 39 85 3962.02 493 19 60 48 108 3591.656 494 14 33 58 121 3317.897 495 19 40 57 137 3673.604 496 17 30 48 101 3658.387 497 10 18 61 140 3600.637 498 10 23 58 102 3539.477 499 19 40 48 77 3292.648 500 30 57 88 190 3036.331 501 43 95 46 94 3156.673 502 25 59 47 101 3294.62 503 22 47 55 129 3344.37 504 28 51 61 112 3272.428 505 26 60 55 115 3310.304 506 19 37 21 36 3350.8 507 12 24 19 33 end format %tm real_month
Listed 100 out of 240 observations
Use the count() option to list more
// add vce(unconditional) to include standard errors appropriate for population inferences:
quietly margins, at(exhibit_force=(0(20)160) reduce_relations=(0(60)600)) saving(predictions,replace)
use predictions, clear
list _at1 _at2 _margin 1/5
rename _at1 exhibit_force
rename _at2 reduce_rela
rename _margin msci_USA_ri
list exhibit_force reduce_relations msci_USA_ri in 1/5, abbreviate(9)
//now we are ready to fill in a basic twoway contour to view the results
twoway contour msci_USA_ri exhibit_force reduce_relations
// this makes a graph
//however if I would like to see te changes in effect and view the predicted probability of hypertension in increments of 0.1
twoway (contour msci_USA_ri exhibit_force reduce_relations, ccuts(0(0.1)1.0)),
xlabel(0(20)160)
ylabel(0(60)600, angle(horizontal))
xtitle("exhibit_force (observations)")
ytitle("reduce_relations (observations)")
ztitle("Predicted_msci_USA_ReturnIndex")
title("Predicted_msci_USA_ReturnIndex by exhibit_force and reductions_of_relations")Predicted_msci_USA_Return Index
quietly margins, at(exhibit_force=(0(20)160) reduce_relations=(0(60)600)) saving(predictions,replace)
use predictions, clear
list _at1 _at2 _margin 1/5
rename _at1 exhibit_force
rename _at2 reduce_rela
rename _margin msci_USA_ri
list exhibit_force reduce_relations msci_USA_ri in 1/5, abbreviate(9)
//now we are ready to fill in a basic twoway contour to view the results
twoway contour msci_USA_ri exhibit_force reduce_relations
// this makes a graph
//however if I would like to see te changes in effect and view the predicted probability of hypertension in increments of 0.1
twoway (contour msci_USA_ri exhibit_force reduce_relations, ccuts(0(0.1)1.0)),
xlabel(0(20)160)
ylabel(0(60)600, angle(horizontal))
xtitle("exhibit_force (observations)")
ytitle("reduce_relations (observations)")
ztitle("Predicted_msci_USA_ReturnIndex")
title("Predicted_msci_USA_ReturnIndex by exhibit_force and reductions_of_relations")Predicted_msci_USA_Return Index
. // add vce(unconditional) to include standard errors appropriate for population inferences:
. quietly margins, at(exhibit_force=(0(20)180) reduce_relations=(0(60)600)) saving(predictions,replace)
variable 'reduce_relations' not found in list of covariates
r(322);
thus this error gives expected outputs for reduce_relations.
unsure how to proceed.
exhibit_force ranges from 1 to 161
reduce relation from 4 to 606.
Q:
- how to get stata to found reduce_relations in my list of covariates
- are the effects of omiting observations for 161 exhibting force and 601 602 603 604 605 in reduce_relations negligible, if goal is to show presence interaction effect.
thank you
Comment