[Mediation-information] mediate function with cluster

Kosuke Imai kimai at Princeton.EDU
Fri Nov 16 13:47:23 CET 2012


Dear Philip,

I'm ccing my collaborators who know more about the details of the package so that they can respond to this. 

Kosuke

Department of Politics
Princeton University
http://imai.princeton.edu

On Nov 16, 2012, at 6:09 AM, Philip Parker <Philip.Parker at uws.edu.au> wrote:

> Dear Professor Imai,
> 
> I am currently working with your mediation package in R which is fantastic. However, when I utalise the cluster augment I get the following error:
> 
> Error in tapply(x, cluster, sum) : arguments must have same length
> 
> I have tried referencing the cluster variable directly and as a charater (i.e. how treat and mediator are called in the function) as follows
> 
> > effects<- mediate(Model2_SingleLevel, Model3_SingleLevel,
> +                   sims=100, treat="Zses", mediator="Ach1", 
> +                   cluster=AchData$SCHOOLID)
> 
> and
> 
> > effects<- mediate(Model2_SingleLevel, Model3_SingleLevel,
> +                   sims=100, treat="Zses", mediator="Ach1", 
> +                   cluster="SCHOOLID")
> 
> I assume it is something very simple that I am foolishly missing but would be greatful for any advice. 
> 
> In passing I also noted that the sandwich package either did not load correctly or was not installed as a dependency with your mediation package. 
> 
> Kind Regards,
> Phil
> 
> Dr. Philip Parker
> Centre for Positive Psychology and Education
> School of Education |University of Western Sydney
> Locked Bag 1797, Penrith, NSW, 2751
> Tel: (612) 9772 6108| Fax: (612) 9772 6432
> http://www.uws.edu.au/centre_for_educational_research/cppe



More information about the Mediation-information mailing list