楼主: 959712305
9570 2

[有偿编程] 求多因素Logistic回归结果做森林图程序。 [推广有奖]

  • 3关注
  • 3粉丝

讲师

21%

还不是VIP/贵宾

-

威望
0
论坛币
1017 个
通用积分
6.2398
学术水平
15 点
热心指数
16 点
信用等级
13 点
经验
546 点
帖子
71
精华
0
在线时间
788 小时
注册时间
2012-8-28
最后登录
2024-2-28

200论坛币
各位大神,我想利用多因素Logistic回归后得到的各因素的OR值、OR值的95%CI和P值做森林图,如这张网上找到的图。我想要的结果与其类似,但是想要每个因素的第一个水平作参照,起OR值为1或无,参照水平无置信区间。感谢帮忙的人。

%$X2T7$NH2THQ~7ZJO2FLH1.jpg (89.13 KB)

%$X2T7$NH2THQ~7ZJO2FLH1.jpg

关键词:logistic回归 logistic ogistic logisti logist 置信区间 程序 森林 网上
沙发
wang1839 在职认证  发表于 2016-6-30 23:03:27 |只看作者 |坛友微信交流群
这个简单,我做一个类似的吧
data or;
input param $10.  or min max  p;
cards;
sex                0.81        1.23        0.53                0.33
age             0.70        1.53        0.52                0.06
bmi                0.85        1.39        0.64                0.29
eduacation         0.89        1.10        0.70                0.76
;
run;


data tot;
        set or;
           CI=put(min,7.2)||' to '||put(max,7.2. -l);
        ord=_n_;
        retain constant 1;
run;


ods path work.templ(update) sashelp.tmplmst(read) sashelp.styles(read);

proc template;
define style mystyle;
parent = Styles.default;
style parskip / fontsize = 0pt;
class text / 'continued' = " ";
class Continued /
         frame=void
         pretext = _undef_
         borderspacing = 0      
         padding = 0 ;     
class GraphBackground/
   backgroundcolor =  white
   color = white;
  class LayoutContainer /
      padding = 0
      borderspacing = 0
      borderwidth = 0
      frame = void
      rules = none
      backgroundcolor = _undef_;
style GraphFonts from GraphFonts/
   'GraphDataFont'=('Times New Roman' ,12pt)
   'GraphUnicodeFont'=('Times New Roman' ,12pt)
   'GraphValueFont'=('Times New Roman' ,12pt)
   'GraphLabelFont'=('Times New Roman' ,12pt)
   'GraphFootnoteFont'=('Times New Roman' ,12pt)  /*Times New Roman*/
   'GraphTitleFont'=('Times New Roman' ,12pt)
   'GraphAnnoFont'=('Times New Roman' ,12pt);

class graph/
   fontweight=bold;
end;
run;





proc template;
  define statgraph ForestPlot;
  begingraph / designwidth=9in designheight=16in;
  layout lattice / columns=3 columngutter=0 columnweights=(0.10 .60 .30 );


layout overlay / walldisplay=none border=false
                   yaxisopts=(reverse=true type=discrete display=none)
                   xaxisopts=(display=none offsetmin=0.25 offsetmax=0.25);
           entry halign=left   "        Parameter" / location=outside valign=top ;
          
      scatterplot y=ord x=eval(constant*1) / markercharacter=param;
        endlayout;  



layout overlay /walldisplay=(fill)
yaxisopts=(display=none reverse=true offsetmin=0.00 offsetmax=0.10)
                   xaxisopts=(type=log offsetmin=0.00 offsetmax=0.00
                           label="<-----Protect Factor   Harm Factor----->"
                  logopts=(base=10 minorticks=true viewmin=0.01 viewmax=100 ) );
      entry halign=center "OR and 95% CIs" / location=outside valign=top ;
      scatterplot y=ord  x=or / xerrorupper=max xerrorlower=min  
           markerattrs=graphdata1(symbol=diamondfilled size=1pct);  
            referenceline x=1 / lineattrs=(pattern=solid);
      referenceline x=0.1 / lineattrs=(pattern=shortdash);
      referenceline x=10 / lineattrs=(pattern=shortdash);
    endlayout;

         layout overlay / walldisplay=none border=false
                   yaxisopts=(reverse=true type=discrete display=none)
                   xaxisopts=(display=none offsetmin=0.25 offsetmax=0.25);
           entry halign=left            "                   OR             95% CI            P" / location=outside valign=top ;
          
      scatterplot y=ord x=eval(constant*1) / markercharacter=or;
          scatterplot y=ord x=eval(constant*2) / markercharacter=ci;
          scatterplot y=ord x=eval(constant*3) / markercharacter=p;
    endlayout;  


  endlayout;
  endgraph;
  end;
run;


/*ods graphics on / height=5.5 in width=10 in border=off;*/
ods rtf file="d:\test.rtf"  style=mystyle;
proc sgrender data=tot template=ForestPlot;
run;
ods rtf close;

使用道具

藤椅
一吴玉 发表于 2017-12-16 20:17:15 |只看作者 |坛友微信交流群
请教大神,用sgplot的程序是什么样的,谢谢!

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-19 15:16