[R-meta] Studentized residuals from rma.mv model using the rstudent function

Viechtbauer, Wolfgang (SP) wolfg@ng@viechtb@uer @ending from m@@@trichtuniver@ity@nl
Tue Aug 7 11:41:49 CEST 2018


Dear Elizabeth,

If you install the 'devel' version of metafor (see: https://github.com/wviechtb/metafor#installation), then rstudent() will work for 'rma.mv' models.

See also:

https://wviechtb.github.io/metafor/news/index.html

Best,
Wolfgang

-----Original Message-----
From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On Behalf Of Trybula, Elizabeth Marie
Sent: Monday, 06 August, 2018 22:25
To: r-sig-meta-analysis using r-project.org
Subject: [R-meta] Studentized residuals from rma.mv model using the rstudent function

We're trying to run a quick analysis of model fit, and would like to include studentized residuals (code example and sample data below signature line). Unfortunately, we're getting an error returned when we explore the "rstudent" function on rma.mv outputs:

Error in UseMethod("rstudent") :
no applicable method for 'rstudent' applied to an object of class "c('rma.mv', 'rma')"

It appears that rstudent isn't yet set in the current package version.

We went back to the website and CRAN documentation and couldn't figure out if it is something that's in development for future versions, or if there's confusion on our part about calling the function. On pages 199-200 of the CRAN documentation, rstudent is listed as a function with the rma.mv model, but in the Usage definitions, it is omitted. (https://cran.r-project.org/web/packages/metafor/metafor.pdf)

Does anyone know if the rstudent function is working in the current package version for rma.mv models?

If it's not in the current version, does anyone happen to have a beta-version of the function that we can play with? If so, we would welcome the chance to beta-test it for you. If not, does anyone have any good resources to suggest?

Thanks in advance for any help that's offered.

Best,

Elizabeth

Elizabeth Trybula
Doctoral Candidate
Purdue University Department of Agronomy
Ecological Sciences and Engineering Interdisciplinary Graduate Program
West Lafayette, IN 47907

#Sample code
fit.reg.example <- head(dat.reg, 20)
fit.reg.example$yi <- fit.reg.example$yi + rnorm(20, 0, 3)
fit.reg.example$vi <- fit.reg.example$vi + rnorm(20, 1, .5)
fit.reg.example$S.leg <- fit.reg.example$S.leg + rnorm(20, 1, .1)

head(fit.reg.example)
fit.example <- rma.mv(yi, vi, mods = ~ leg - 1,
                                random = ~ leg | study,
                                data = fit.reg.example,
                                struct = "CS")

rstudent(fit.example)
residuals(fit.example, type = 'rstudent')
#

#Sample data
print(fit.reg.example)
   study leg          yi        vi     S.leg
1      1   C  1.80857563 0.4696227 0.8349112
2      1   B  0.59614768 0.3481413 0.9896877
3      1   D  1.94789714 0.4914293 0.8162649
4      1   E  5.69724562 1.6857753 0.7652821
5      1   F  4.80478218 1.2952472 0.7659036
6      1   G  4.89888935 1.3332965 0.8103878
7      1   H  3.41733531 0.8199242 0.7374167
8      3   C  0.39048716 0.5095300 0.8194892
9      3   B -0.02602006 0.5000423 1.5372757
10     3   D -0.27496234 0.5047253 0.9455840
11     3   E  1.13476584 0.5804808 1.5421684
12     3   F  0.35406352 0.5078351 1.4969065
13     3   G  0.95926876 0.5575123 1.4698696
14     3   H  0.46924378 0.5137619 0.7671918
15     5   C  1.23044148 0.5946241 0.7395719
16     5   B  0.97830991 0.5598181 0.7768499
17     5   D  0.26557617 0.5044082 0.6024637
18     5   E  4.20096851 1.6030085 0.6831758
19     5   F  4.36573445 1.6912273 0.5703508
20     5   G  3.90316892 1.4521705 0.5764547



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