Announcement

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

  • Graphing a continous-by-continous interaction term using marginsplot

    Dear Statlist,

    My study is about how city attachment (placeattatch) and city attractiveness (attractivecultur) interplays in influencing donation intention (DV; willtodonate_continue). All variables are survey-based 7-point Likert scaled items, and I treat these as continuous variables in my analysis.
    I graphed the interaction terms of the two using the following commands.

    Code:
    reg willtodonate_continue c.placeattatch##c.attractivecultur attractivetour  attractiveinno currworkinglocation volunteerex livingex currentresidency age gender
    margins, at( placeattatch=(1(1)7) attractivecultur =(1(1)7))
    marginsplot, noci x(placeattatch) recast(line) xlabel(1(1)7)
    The commands give me the following figure, which interprets as ... The more one percieves the city to be attractive (eg., attractivecultur=7), the more city attachment influences donation intention in a positive way.
    As I am mostly familiar with categorical*continous interaction analyses, I wonder first, is this the right way to graph my results. Any ideas to graph this in a more intuitive fashion?
    Secondly, is there a way I can draw a line that represents the average (coefficient of "placeattatch" in the regression results) along with the 7 lines? Mainly for comparison.
    Graph.gph

    My dataset looks like the following. Thanks.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input byte(willtodonate_continue placeattatch attractivecultur attractivetour attractiveinno currworkinglocation volunteerex livingex) int currentresidency byte(age gender)
    4 6 6 6 4 0 0 0  804 58 0
    1 2 2 4 2 0 0 0  111 56 0
    5 6 6 5 6 0 1 1 1511 44 0
    2 2 6 6 4 0 0 0 1308 27 0
    3 6 5 5 5 0 0 0  831 43 0
    4 6 6 5 3 0 1 0  124 59 0
    3 5 5 5 5 0 0 0  123 69 0
    4 5 6 7 6 0 0 0  808 52 0
    3 5 6 7 3 0 0 0  115 46 0
    4 5 6 6 7 0 0 1  505 25 1
    1 4 1 7 1 0 0 0  404 25 1
    2 5 5 5 3 0 0 0  827 64 0
    4 6 6 7 5 0 0 0 1419 62 0
    2 4 4 6 4 0 0 0  405 28 1
    4 4 5 6 3 0 0 0  802 57 0
    3 4 3 4 3 0 0 0  118 43 0
    4 5 6 6 3 0 0 0  124 61 0
    2 5 2 6 3 0 0 0  408 40 1
    2 4 4 5 4 0 0 0  110 60 0
    4 6 4 7 4 0 0 0  817 43 0
    1 1 1 4 2 0 0 0  125 27 1
    1 5 1 7 1 0 0 0  120 42 0
    4 4 5 5 5 0 1 0  827 47 1
    2 2 3 5 4 0 0 1  811 25 1
    2 6 3 6 3 0 0 0  828 39 0
    2 6 7 7 1 0 0 0 1401 42 0
    3 5 6 6 3 0 0 0  802 51 0
    4 3 2 5 4 0 0 0  823 35 1
    4 4 5 5 6 0 0 0  107 30 1
    3 6 6 6 4 0 0 0  105 45 1
    2 4 3 6 1 0 0 0  102 26 0
    1 4 4 6 2 0 0 0  115 32 0
    1 4 4 6 5 0 0 0  820 43 1
    2 4 4 5 3 0 0 0  119 51 1
    1 1 1 4 1 0 0 0 1212 50 0
    2 2 4 5 3 0 0 0  118 32 0
    5 6 6 6 5 0 1 1  112 56 0
    4 6 5 6 2 0 0 0  808 45 0
    3 4 4 5 4 0 0 0 1110 64 0
    2 4 4 4 4 0 0 1 1601 61 0
    3 4 4 5 4 0 0 0  402 67 1
    2 4 3 5 3 0 0 0  701 27 0
    2 5 3 4 3 0 0 0  109 53 0
    4 5 5 5 4 0 0 0  809 36 1
    3 4 6 7 6 0 0 0  411 27 1
    3 4 5 5 3 0 0 0  115 54 0
    1 4 6 7 4 0 0 0 1113 22 1
    4 4 5 6 4 0 0 1  124 59 0
    2 3 5 5 4 0 0 0  813 28 0
    4 5 5 6 2 0 0 0  825 46 0
    2 4 1 5 1 0 0 0  121 26 1
    2 2 3 6 2 0 0 0  830 45 0
    3 5 6 5 4 0 0 1  802 43 0
    2 4 6 6 5 0 0 0  812 28 1
    1 2 2 5 1 0 0 0  408 22 0
    1 4 3 5 3 0 0 0  829 35 0
    4 5 6 5 4 0 0 0  812 22 1
    1 4 4 6 4 0 0 0  108 30 1
    5 4 4 4 4 0 0 0  103 36 1
    1 2 1 4 2 0 0 0  819 24 1
    2 2 4 4 4 0 0 0 1011 38 1
    6 6 5 6 6 0 1 0  123 33 0
    5 3 4 6 4 0 0 0  402 27 1
    3 4 5 6 4 0 0 0  123 41 0
    1 2 3 3 1 0 0 0  604 39 1
    2 3 2 3 2 0 1 1 1311 37 0
    3 3 6 7 4 0 0 0  411 24 1
    3 4 5 6 5 0 0 0  407 36 0
    1 4 5 5 2 0 0 0  216 33 1
    3 6 6 6 4 0 0 0  802 35 1
    3 4 5 5 3 0 0 0  815 39 0
    6 5 5 6 4 0 0 0  207 37 1
    3 5 6 6 5 0 0 0  603 48 0
    2 2 2 5 2 0 0 0  823 47 0
    1 1 1 1 1 0 0 0  407 48 0
    3 4 4 6 2 0 0 0  813 31 1
    1 2 5 5 3 0 0 0  108 41 0
    5 6 4 5 2 0 0 0  402 49 0
    3 4 7 6 4 0 0 0 1718 40 1
    2 5 5 6 5 0 0 0 1709 48 0
    5 3 5 4 5 0 1 0  119 34 0
    1 3 4 5 4 0 0 0  814 34 1
    1 5 4 5 3 1 0 1  801 28 0
    4 5 4 5 3 0 0 0  411 51 0
    4 5 4 4 5 0 0 1  118 41 0
    3 4 5 5 4 0 0 0  404 38 1
    1 2 4 5 4 0 0 0  813 51 0
    1 5 4 7 7 0 0 0  208 30 1
    2 4 5 4 4 0 1 0  406 33 1
    1 4 6 6 4 0 0 0  831 39 1
    3 3 4 6 4 0 0 0  110 36 0
    2 3 3 4 2 0 0 0  823 52 1
    3 4 3 5 2 0 1 1  103 61 1
    5 5 5 5 5 0 0 1  827 51 1
    4 4 3 4 3 0 0 1  302 27 0
    2 3 4 5 3 0 0 0  402 52 0
    3 4 6 6 4 0 0 0  912 51 0
    3 5 5 5 5 0 0 0  406 47 0
    4 3 5 5 4 0 0 0 1106 28 0
    2 5 5 5 4 0 0 0  104 56 1
    end
Working...
X