[R-meta] Pairwise comparisons between the factor levels and compact letter display (cld)

Jan Kardela (PGR) J@H@K@rdel@2 @ending from newc@@tle@@c@uk
Wed Aug 15 18:36:46 CEST 2018

Dear Wolfgang,
Thank you for your message. 

Below I provide the snippet of my data together with the code I had been using to calculate all the statistics. 

Maybe just a little explanation of my data set as it might seem strange at first. I have run 5 independent settlement studies each using different populations of larvae. In each study there are 4 different samples (A (c), B, C, D), each consisting of few replicates (n1). Every single settlement experiment was conducted using different set of "participants" i.e. larvae. As a control group for each experiment I selected sample A (c) from appropriate Study. In case of sample C (experiments 11,12,13,14) there was no settlement so I decided to put the 0.01 values as for mean and stddev.    

In order to merge the results from my studies I conducted meta-regression analysis with the Sample as a categorical moderator and used random switch to allow the amount of residual heterogeneity to be different in each Sample subgroup.

As I mentioned earlier I wanted to run some sort of Tukey post-hoc test on the meta-regression model to determine differences between the Sample levels. In order to do that I ran glht() which gave me all pairwise comparisons, but with so many pairs (my full data set consists of 11 different samples/levels not 4 as in snippet) I wanted to use compact letter display notification to more clearly present the differences between the samples. Obviously, I could use the plot function to graphically display all pairs of groups but in my case some of the groups overlap with others making the story not very clear. 

Thank you again for your time and expertise!

Best regards,

#### ==== BEGINNING OF CODE ==== ####


               Sample=c("A (c)", "A (c)", "A (c)","A (c)", "A (c)", "B","B","B","B","B","C","C","C","C","C","D","D","D","D","D"),




tukey_glht<-glht(rma.meta, linfct=cbind(contrMat(c("A (c)"=1,"B"=1,"C"=1,"D"=1),type="Tukey")),test=adjusted("Bonferroni"))
cld(tukey_glht) ## That's where I get the error: "Error in formula.default(object, env = baseenv()) : invalid formula"

#### ====END OF CODE==== ####

-----Original Message-----
From: Viechtbauer, Wolfgang (SP) <wolfgang.viechtbauer using maastrichtuniversity.nl> 
Sent: Tuesday, August 14, 2018 9:09 PM
To: Jan Kardela (PGR) <J.H.Kardela2 using newcastle.ac.uk>; r-sig-meta-analysis using r-project.org
Subject: RE: [R-meta] Pairwise comparisons between the factor levels and compact letter display (cld)

Hi Jan,

Can you provide a small reproducible example that yields this error? I have never tried to see how well metafor objects play together with cld().


-----Original Message-----
From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On Behalf Of Jan Kardela (PGR)
Sent: Monday, 13 August, 2018 12:01
To: r-sig-meta-analysis using r-project.org
Subject: [R-meta] Pairwise comparisons between the factor levels and compact letter display (cld)

I am doing a multilevel meta-analysis in metafor and I am running a glht function from multcomp package to determine all-pairwise comparisons. I use contrMat function with Tukey switch to obtain the matrix contrast. As my categorical factor has 11 levels I would like to have some sort of compact letter display notification (cld) to more efficiently report the differences between all pairs. When I try to feed the glht model to the cld function I get an error "Error in formula.default(object, env = baseenv()) : invalid formula". Could someone please point me in the right direction and provide some advice?
Thank you in advance for all the help!
Best regards,

More information about the R-sig-meta-analysis mailing list