lesson2 multcomp::glht

ancova123edited

 

Dataset=read.csv("http://fudan.lxxm.com/g15210730030/wp-content/uploads/sites/74/2016/01/ancova123edited.csv");
attach(Dataset);
summary(Dataset)
##数据引用自"http://wps.ablongman.com/ab_tabachnick_multistats_6/"的ancova数据包,里面包含Attitude toward use of drugs,Physical health symptoms,Mental health symptoms,Use of psychotropic drugs,Current employment status,Religious affiliation变量,本文只使用attdrug和emplmnt
##only cares about attdrug~0+emplmnt;
lm1<-lm(attdrug~0+emplmnt);
summary(lm1);
anova(lm1);
##do anova to lm1, see whether the status of employment will effect the attitude toward drug;
library(multcomp);
h1<-glht(lm1,'emplmntUNEMPLOYED-emplmntEMPLOYED==0');
summary(h1);
##compare the status of unemployed with employed;
confint(h1);
 
This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to lesson2 multcomp::glht

  1. fudanpsy says:

    #*.csv 中 emplmnt 应当保存水平标签,目前是数值

    Line1 改为> Dataset=read.csv("http://fudan.lxxm.com/g15210730030/wp-content/uploads/sites/74/2016/01/ancova.csv");
    Line2 加> attach(Dataset)

  2. fudanpsy says:

    修订已阅,运行无误

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>