Dear Dr. Wolfgang and All, I want to extract unbiased residuals of a rma.mv function to use in a repeatability analysis for another random variable in the rptR package. Thus, I want to control for precision (or weight) for each effect size and phylogenetic non-independence. Which kind of residuals should be more appropriate to do that in a mixed-effects multilevel meta-analysis and how can I extract them from the rma.mv function? Any help is welcome. All the best, _______________________________________________________ *Prof. Dr. Rafael Rios Moura* *scientia amabilis * N?cleo de Extens?o e Pesquisa em Ecologia e Evolu??o (NEPEE) Departamento de Ci?ncia Biol?gicas UEMG Ituiutaba ORCID: http://orcid.org/0000-0002-7911-4734 Curr?culo Lattes: http://lattes.cnpq.br/4264357546465157 <http://orcid.org/0000-0002-7911-4734> <http://lattes.cnpq.br/4264357546465157> <http://lattes.cnpq.br/4264357546465157>Research Gate: https://www.researchgate.net/profile/Rafael_Rios_Moura2 <http://orcid.org/0000-0002-7911-4734> Rios de Ci?ncia: https://www.youtube.com/channel/UCu2186wIJKji22ai8tvlUfg <http://orcid.org/0000-0002-7911-4734>
[R-meta] Extracting residuals from rma.mv function
5 messages · Rafael Rios, Wolfgang Viechtbauer
1 day later
Dear Rafael,
I don't understand the details of what you are trying to do, but you can obtain residuals from a 'rma.mv' model with resid(). However, that will only give you the residuals and no indication of their precision. With rstandard(), you can get get the residuals ('resid') and the corresponding standard errors ('se'). If the model you have fitted accounted for phylogenetic non-independence and differences in the precision of the effect sizes, then so will the residuals and corresponding standard errors.
However, note that residuals are not independent (that is even the case in simple regression models outside of the meta-analytic context). With:
vcov(res, type="resid")
(assuming the model object is called 'res') you can get the full var-cov matrix of the residuals. You will note that this is not a diagonal matrix. The standard errors are just the square root of the diagonal elements:
sqrt(diag(vcov(res, type="resid")))
So, whatever you intend to do with the residuals may require that you not only account for differences in their precision, but also their covariances.
Best,
Wolfgang
-----Original Message----- From: Rafael Rios Moura [mailto:biorafaelrm at gmail.com] Sent: Saturday, 05 December, 2020 18:26 To: r-sig-meta-analysis at r-project.org; Viechtbauer, Wolfgang (SP) Subject: Extracting residuals from rma.mv function Dear Dr. Wolfgang and All, I want to extract unbiased residuals of a rma.mv function to use in a repeatability analysis for another random variable in the rptR package. Thus, I want to control for precision (or weight) for each effect size and phylogenetic non-independence. Which kind of residuals should be more appropriate to do that in a mixed-effects multilevel meta-analysis and how can I extract them from the rma.mv function? Any help is welcome. All the best,
_______________________________________________________ Prof. Dr. Rafael Rios Moura scientia amabilis N?cleo de Extens?o e Pesquisa em Ecologia e Evolu??o (NEPEE) Departamento de Ci?ncia Biol?gicas UEMG Ituiutaba ORCID:?http://orcid.org/0000-0002-7911-4734 Curr?culo Lattes: http://lattes.cnpq.br/4264357546465157 Research Gate: https://www.researchgate.net/profile/Rafael_Rios_Moura2 Rios de Ci?ncia:?https://www.youtube.com/channel/UCu2186wIJKji22ai8tvlUfg
1 day later
Dear Wolfgang, Thank you for the reply. My idea is to obtain unbiased weighted outcomes to test their repeatability in spatial and temporal replicates. I conducted random-effects multilevel meta-analyses using rma.mv function (weighted by the inverse of variance) controlling for phylogenetic relatedness. Then, I extracted residuals using residuals(my model, type = "response") and used the outcomes in the repeatability tests. Do you see any problem with this approach? All the best, Rafael. _______________________________________________________ *Prof. Dr. Rafael Rios Moura* *scientia amabilis * N?cleo de Extens?o e Pesquisa em Ecologia e Evolu??o (NEPEE) Departamento de Ci?ncia Biol?gicas UEMG Ituiutaba ORCID: http://orcid.org/0000-0002-7911-4734 Curr?culo Lattes: http://lattes.cnpq.br/4264357546465157 <http://orcid.org/0000-0002-7911-4734> <http://lattes.cnpq.br/4264357546465157> <http://lattes.cnpq.br/4264357546465157>Research Gate: https://www.researchgate.net/profile/Rafael_Rios_Moura2 <http://orcid.org/0000-0002-7911-4734> Rios de Ci?ncia: https://www.youtube.com/channel/UCu2186wIJKji22ai8tvlUfg <http://orcid.org/0000-0002-7911-4734> Em seg., 7 de dez. de 2020 ?s 04:53, Viechtbauer, Wolfgang (SP) < wolfgang.viechtbauer at maastrichtuniversity.nl> escreveu:
Dear Rafael,
I don't understand the details of what you are trying to do, but you can
obtain residuals from a 'rma.mv' model with resid(). However, that will
only give you the residuals and no indication of their precision. With
rstandard(), you can get get the residuals ('resid') and the corresponding
standard errors ('se'). If the model you have fitted accounted for
phylogenetic non-independence and differences in the precision of the
effect sizes, then so will the residuals and corresponding standard errors.
However, note that residuals are not independent (that is even the case in
simple regression models outside of the meta-analytic context). With:
vcov(res, type="resid")
(assuming the model object is called 'res') you can get the full var-cov
matrix of the residuals. You will note that this is not a diagonal matrix.
The standard errors are just the square root of the diagonal elements:
sqrt(diag(vcov(res, type="resid")))
So, whatever you intend to do with the residuals may require that you not
only account for differences in their precision, but also their covariances.
Best,
Wolfgang
-----Original Message----- From: Rafael Rios Moura [mailto:biorafaelrm at gmail.com] Sent: Saturday, 05 December, 2020 18:26 To: r-sig-meta-analysis at r-project.org; Viechtbauer, Wolfgang (SP) Subject: Extracting residuals from rma.mv function Dear Dr. Wolfgang and All, I want to extract unbiased residuals of a rma.mv function to use in a repeatability analysis for another random variable in the rptR package. Thus, I want to control for precision (or weight) for each effect size and phylogenetic non-independence. Which kind of residuals should be more appropriate to do that in a mixed-effects multilevel meta-analysis and how can I extract them from the rma.mv function? Any help is welcome. All the best,
_______________________________________________________ Prof. Dr. Rafael Rios Moura scientia amabilis N?cleo de Extens?o e Pesquisa em Ecologia e Evolu??o (NEPEE) Departamento de Ci?ncia Biol?gicas UEMG Ituiutaba ORCID: http://orcid.org/0000-0002-7911-4734 Curr?culo Lattes: http://lattes.cnpq.br/4264357546465157 Research Gate: https://www.researchgate.net/profile/Rafael_Rios_Moura2 Rios de Ci?ncia: https://www.youtube.com/channel/UCu2186wIJKji22ai8tvlUfg
I am not familiar with repeatability tests, so I cannot comment on that part. However, if you use residuals for further analyses, you may want to account for differences in their standard errors and the fact that they are correlated. As decribed, you can get their standard errors via rstandard() and you can get their whole var-cov matrix with vcov(..., type="resid"). Best, Wolfgang
-----Original Message----- From: Rafael Rios Moura [mailto:biorafaelrm at gmail.com] Sent: Tuesday, 08 December, 2020 13:45 To: Viechtbauer, Wolfgang (SP) Cc: r-sig-meta-analysis at r-project.org Subject: Re: Extracting residuals from rma.mv function Dear Wolfgang, Thank you for the reply. My idea is to obtain unbiased weighted outcomes to test their repeatability in spatial and temporal replicates. I conducted random-effects multilevel meta-analyses using rma.mv function (weighted by the inverse of variance) controlling for phylogenetic relatedness. Then, I extracted residuals using residuals(my model, type = "response") and used the outcomes in the repeatability tests. Do you see any problem with this approach? All the best, Rafael.
_______________________________________________________ Prof. Dr. Rafael Rios Moura scientia amabilis N?cleo de Extens?o e Pesquisa em Ecologia e Evolu??o (NEPEE) Departamento de Ci?ncia Biol?gicas UEMG Ituiutaba ORCID:?http://orcid.org/0000-0002-7911-4734 Curr?culo Lattes: http://lattes.cnpq.br/4264357546465157 Research Gate: https://www.researchgate.net/profile/Rafael_Rios_Moura2 Rios de Ci?ncia:?https://www.youtube.com/channel/UCu2186wIJKji22ai8tvlUfg Em seg., 7 de dez. de 2020 ?s 04:53, Viechtbauer, Wolfgang (SP) <wolfgang.viechtbauer at maastrichtuniversity.nl> escreveu: Dear Rafael, I don't understand the details of what you are trying to do, but you can obtain residuals from a 'rma.mv' model with resid(). However, that will only give you the residuals and no indication of their precision. With rstandard(), you can get get the residuals ('resid') and the corresponding standard errors ('se'). If the model you have fitted accounted for phylogenetic non-independence and differences in the precision of the effect sizes, then so will the residuals and corresponding standard errors. However, note that residuals are not independent (that is even the case in simple regression models outside of the meta-analytic context). With: vcov(res, type="resid") (assuming the model object is called 'res') you can get the full var-cov matrix of the residuals. You will note that this is not a diagonal matrix. The standard errors are just the square root of the diagonal elements: sqrt(diag(vcov(res, type="resid"))) So, whatever you intend to do with the residuals may require that you not only account for differences in their precision, but also their covariances. Best, Wolfgang -----Original Message----- From: Rafael Rios Moura [mailto:biorafaelrm at gmail.com] Sent: Saturday, 05 December, 2020 18:26 To: r-sig-meta-analysis at r-project.org; Viechtbauer, Wolfgang (SP) Subject: Extracting residuals from rma.mv function Dear Dr. Wolfgang and All, I want to extract unbiased residuals of a rma.mv function to use in a repeatability analysis for another random variable in the rptR package. Thus, I want to control for precision (or weight) for each effect size and phylogenetic non-independence. Which kind of residuals should be more appropriate to do that in a mixed-effects multilevel meta-analysis and how can I extract them from the rma.mv function? Any help is welcome. All the best, _______________________________________________________ Prof. Dr. Rafael Rios Moura scientia amabilis N?cleo de Extens?o e Pesquisa em Ecologia e Evolu??o (NEPEE) Departamento de Ci?ncia Biol?gicas UEMG Ituiutaba ORCID:?http://orcid.org/0000-0002-7911-4734 Curr?culo Lattes: http://lattes.cnpq.br/4264357546465157 Research Gate: https://www.researchgate.net/profile/Rafael_Rios_Moura2 Rios de Ci?ncia:?https://www.youtube.com/channel/UCu2186wIJKji22ai8tvlUfg
1 day later
Dear Wolfgang, Thank you very much for the reply. I tried to add standard errors as a fixed predictor in the repeatability test, but I obtained these errors: Warning messages: 1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,: unable to evaluate scaled gradient 2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,: Problem with Hessian check (infinite or missing values?) I used an optimizer, but It did not work. I do not know exactly if I need to account for standard errors in the repeatability test. It seems that the residuals are enough, but I would be grateful if you can share with me your thoughts about it. I ran a random-effects multilevel meta-analysis using effect size ID, study ID, species ID, and phylogenetic correlations as random effects. Then, I extracted standard residuals to use as a response variable in the repeatability test using rptR package. The test is a general linear mixed model which measures the among-group variance attributed to a particular random variable (corresponding to spatial replicates, for example) divided by the sum of the within-group residual variance and the among-group variance to calculate a R statistic. rpt function of rptR package also performs bootstrapping methods to calculate confidence intervals and P-values. Do you think that I need to include another variable within the repeatability model? Thank you in advance. Stoffel et al. 2007: https://besjournals.onlinelibrary.wiley.com/doi/pdf/10.1111/2041-210X.12797%4010.1111/%28ISSN%292041-210X.CODEVI2018 All the best, _______________________________________________________ *Prof. Dr. Rafael Rios Moura* *scientia amabilis * N?cleo de Extens?o e Pesquisa em Ecologia e Evolu??o (NEPEE) Departamento de Ci?ncia Biol?gicas UEMG Ituiutaba ORCID: http://orcid.org/0000-0002-7911-4734 Curr?culo Lattes: http://lattes.cnpq.br/4264357546465157 <http://orcid.org/0000-0002-7911-4734> <http://lattes.cnpq.br/4264357546465157> <http://lattes.cnpq.br/4264357546465157>Research Gate: https://www.researchgate.net/profile/Rafael_Rios_Moura2 <http://orcid.org/0000-0002-7911-4734> Rios de Ci?ncia: https://www.youtube.com/channel/UCu2186wIJKji22ai8tvlUfg <http://orcid.org/0000-0002-7911-4734> Em ter., 8 de dez. de 2020 ?s 11:20, Viechtbauer, Wolfgang (SP) < wolfgang.viechtbauer at maastrichtuniversity.nl> escreveu:
I am not familiar with repeatability tests, so I cannot comment on that part. However, if you use residuals for further analyses, you may want to account for differences in their standard errors and the fact that they are correlated. As decribed, you can get their standard errors via rstandard() and you can get their whole var-cov matrix with vcov(..., type="resid"). Best, Wolfgang
-----Original Message----- From: Rafael Rios Moura [mailto:biorafaelrm at gmail.com] Sent: Tuesday, 08 December, 2020 13:45 To: Viechtbauer, Wolfgang (SP) Cc: r-sig-meta-analysis at r-project.org Subject: Re: Extracting residuals from rma.mv function Dear Wolfgang, Thank you for the reply. My idea is to obtain unbiased weighted outcomes
to
test their repeatability in spatial and temporal replicates. I conducted random-effects multilevel meta-analyses using rma.mv function (weighted
by
the inverse of variance) controlling for phylogenetic relatedness. Then, I extracted residuals using residuals(my model, type = "response") and used the outcomes in the repeatability tests. Do you see any problem with this approach? All the best, Rafael.
_______________________________________________________ Prof. Dr. Rafael Rios Moura scientia amabilis N?cleo de Extens?o e Pesquisa em Ecologia e Evolu??o (NEPEE) Departamento de Ci?ncia Biol?gicas UEMG Ituiutaba ORCID: http://orcid.org/0000-0002-7911-4734 Curr?culo Lattes: http://lattes.cnpq.br/4264357546465157 Research Gate: https://www.researchgate.net/profile/Rafael_Rios_Moura2 Rios de Ci?ncia: https://www.youtube.com/channel/UCu2186wIJKji22ai8tvlUfg Em seg., 7 de dez. de 2020 ?s 04:53, Viechtbauer, Wolfgang (SP) <wolfgang.viechtbauer at maastrichtuniversity.nl> escreveu: Dear Rafael, I don't understand the details of what you are trying to do, but you can obtain residuals from a 'rma.mv' model with resid(). However, that will
only
give you the residuals and no indication of their precision. With
rstandard(), you can get get the residuals ('resid') and the corresponding
standard errors ('se'). If the model you have fitted accounted for
phylogenetic non-independence and differences in the precision of the
effect
sizes, then so will the residuals and corresponding standard errors. However, note that residuals are not independent (that is even the case in simple regression models outside of the meta-analytic context). With: vcov(res, type="resid") (assuming the model object is called 'res') you can get the full var-cov matrix of the residuals. You will note that this is not a diagonal matrix. The standard errors are just the square root of the diagonal elements: sqrt(diag(vcov(res, type="resid"))) So, whatever you intend to do with the residuals may require that you not only account for differences in their precision, but also their
covariances.
Best, Wolfgang
-----Original Message----- From: Rafael Rios Moura [mailto:biorafaelrm at gmail.com] Sent: Saturday, 05 December, 2020 18:26 To: r-sig-meta-analysis at r-project.org; Viechtbauer, Wolfgang (SP) Subject: Extracting residuals from rma.mv function Dear Dr. Wolfgang and All, I want to extract unbiased residuals of a rma.mv function to use in a repeatability analysis for another random variable in the rptR package. Thus, I want to control for precision (or weight) for each effect size
and
phylogenetic non-independence. Which kind of residuals should be more appropriate to do that in a mixed-effects multilevel meta-analysis and
how
can I extract them from the rma.mv function? Any help is welcome. All the best,
_______________________________________________________ Prof. Dr. Rafael Rios Moura scientia amabilis N?cleo de Extens?o e Pesquisa em Ecologia e Evolu??o (NEPEE) Departamento de Ci?ncia Biol?gicas UEMG Ituiutaba ORCID: http://orcid.org/0000-0002-7911-4734 Curr?culo Lattes: http://lattes.cnpq.br/4264357546465157 Research Gate: https://www.researchgate.net/profile/Rafael_Rios_Moura2 Rios de Ci?ncia: