Announcement

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

  • How to visually depict how age affects the association between an independent variable on a dependent variable over certain percentiles

    Hi!

    I'm looking for a way to visually depict how age affects the association between an independent variable on a dependent variable over certain percentiles
    So far I have used sqreg with bootstrapped standard errors stratified by age group and entered the output for _cons and the interaction coefficient for the 75th, 85th and 95th percentile in Excel and as you can see, the association decreases with age (please see the attached picture).
    However, I now want to plot this decreasing interaction over age as a continuous variable instead of stratified by age group.

    I have tried

    sqreg cacs_tot parod1 c.ageatvisitone , quantile(.75 .85 .95) reps(100)
    qregplot c.ageatvisitone,

    But this does not give me what I want (please see attached image).

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int cacs_tot float(parod1 ageatvisitone)
    0 0 63.6
    1 0   57
    0 0 62.2
    0 0 53.3
    0 0 50.7
    0 0 53.5
    0 0 53.4
    . 1   55
    0 1 55.4
    7 0 50.5
    end

    Regards,
    Niko
    Attached Files
Working...
X