Announcement

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

  • logitcprplot or alternative illustration?

    Dear all,
    I am struggling with a graphical illustration for the following situation:
    • "newvar": binary outcome variable indicating whether someone buys a new car or not.
    • "incentive": variable of interest is a summary measure that captures different aspects (finances, needs etc.) influencing the purchase decision.
    I want to find out whether this incentive variable is adequate to explain the "newcar" variable. Moreover I want to find out whether this differs by age and gender. In other words - do females respond to the incentives more accurately than males?
    For a first impression I would like to have a graphical illustration. I tried the following, but I am not sure whether this is the best way for my intention:

    Code:
    logit newcar incentive
    logitcprplot incentive, rcspline(ci) by(female)
    Do you have any other ideas for a better illustration?

    Thanks and have a great weekend,
    Sam


    I am using Stata 14, version 1.0.4 28jan2009 of logitcprplot. Here is some example data:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input byte(ID newcar) double incentive byte age float female
      3 0   .03972538035415816 28 1
      4 0   .16682683928769018 33 1
      5 0 .0012173821879535836 31 1
      6 0   .20561523090611494 39 1
      7 0   .13439488561921117 28 0
      8 0   .09112885675571442 30 0
      9 0   .04690987263185393 26 1
     10 0   .04690987263185393 26 1
     11 0   .08978829754195784 31 0
     12 0   .12111005208256041 26 0
     14 1   .04059250267250229 37 1
     15 1   .20676567212001254 37 0
     17 0   .32137271478198465 38 1
     18 0   .02069449099176917 29 1
     20 0 .0012173821879535836 31 1
     21 1   .16682683928769018 33 1
     22 1   .02126607470428645 37 1
     23 1   .26704398470400553 33 0
     24 1    .1715611891895402 36 0
     25 1   .11721748713877664 31 0
     26 1   .32483437782415053 33 0
     29 1    .3885486604017397 39 0
     32 1   .32137271478198465 38 1
     33 0   .04059250267250229 37 1
     34 0   .23438664769315412 34 1
     35 1   .14764137688628484 35 0
     36 1    .3433477964308977 38 0
     37 0   .11965222819764557 30 0
     38 0  .011503910217765471 32 0
     39 0    .0457394323233342 27 1
     40 0    .0537767431407912 26 1
     41 0   .11191945729808164 25 0
     42 1   .13861102790755997 27 0
     43 1   .13133017107293066 29 0
     44 0  .043554096752659664 25 1
     45 0  .052776501982149414 27 1
     46 1   .07428374347310765 35 1
     47 0   .08841490098710833 33 1
     48 0   .04690987263185393 26 1
     49 0   .11662819014695244 26 0
     50 0   .13133017107293066 29 0
     51 1   .32137271478198465 38 1
     52 1   .21262513175234668 35 0
     53 1   .25588355968243515 39 0
     54 1   .20129658769110298 36 0
     55 1    .0443966984639766 30 0
     56 0    .1023023256345485 28 0
     57 1   .07428374347310765 35 1
     59 1   .08841490098710833 33 1
     60 0   .03268199621188424 27 1
     61 0   .10743767074877218 26 0
     62 0    .0457394323233342 27 1
     63 0  .055220528743400873 25 1
     64 0   .10040844108317014 29 0
     65 1    .2740306391242877 38 0
     66 1   .19683912030636308 36 0
     67 1   .03686372394791417 32 0
     70 1   .02126607470428645 37 1
     71 1    .4323128507444171 39 1
     72 0  .022917451373031236 28 1
     74 0   .07753927869910902 34 1
     75 0    .0537767431407912 26 1
     76 0   .05017170816564163 29 1
     78 0    .1715611891895402 36 0
     79 0   .26182369323299726 34 0
     80 0   .12957276106988652 28 0
     81 0   .11662819014695244 26 0
     82 1   .09861978330573328 27 0
     83 1   .30891493628814753 39 0
     84 0   .05017170816564163 29 1
     85 0    .0537767431407912 26 1
     86 0     .043881497903992 28 1
     87 1   .09112885675571442 30 0
     88 1   .13439488561921117 28 0
     90 0   .03814587588655128 29 1
     92 1   .22506447668557927 38 0
     93 0   .10471420373182062 29 0
     94 1   .20129658769110298 36 0
     95 1   .35704698117849354 34 0
     96 0   .10356424623493078 27 0
     97 0   .07753927869910902 34 1
     99 1   .30891493628814753 39 0
    100 1   .26704398470400553 33 0
    end

  • #2
    Thank you for sharing data and command correctly. It helps a lot.

    I wonder whether you wish something like this:

    Code:
    .logit newcar incentive age i.female
    .margins female, dydx(age) at(incentive=(0.0012(0.01)0.44))
    .marginsplot
    Or maybe this way:

    Code:
    .margins female, dydx(incentive) at(age=(25(1)40))
    .marginsplot
    Hopefully that helps.
    Last edited by Marcos Almeida; 28 Apr 2017, 07:56.
    Best regards,

    Marcos

    Comment

    Working...
    X