`profile.rma.Rd`

Function to profile the (restricted) log-likelihood for objects of class `"rma.uni"`

and `"rma.mv"`

.

# S3 method for rma.uni profile(fitted, xlim, ylim, steps=20, progbar=TRUE, parallel="no", ncpus=1, cl=NULL, plot=TRUE, pch=19, cline=FALSE, …) # S3 method for rma.mv profile(fitted, sigma2, tau2, rho, gamma2, phi, xlim, ylim, steps=20, lltol=1e-06, startmethod="init", progbar=TRUE, parallel="no", ncpus=1, cl=NULL, plot=TRUE, pch=19, cline=FALSE, …) # S3 method for profile.rma print(x, …) # S3 method for profile.rma plot(x, xlim, ylim, pch=19, xlab, ylab, main, cline=FALSE, …)

fitted | an object of class |
---|---|

x | an object of class |

sigma2 | integer specifying for which \(\sigma^2\) value the likelihood should be profiled (only relevant for |

tau2 | integer specifying for which \(\tau^2\) value the likelihood should be profiled (only relevant for |

rho | integer specifying for which \(\rho\) value the likelihood should be profiled (only relevant for |

gamma2 | integer specifying for which \(\gamma^2\) value the likelihood should be profiled (only relevant for |

phi | integer specifying for which \(\phi\) value the likelihood should be profiled (only relevant for |

xlim | optional vector specifying the lower and upper limit of the parameter over which the profiling should be done. If unspecified, the function tries to set these limits automatically. |

ylim | optional vector specifying the y-axis limits when plotting the profiled likelihood. If unspecified, the function tries to set these limits automatically. |

steps | number of points between |

lltol | numerical tolerance used when comparing values of the profiled log-likelihood with the log-likelihood of the fitted model (the default is 1e-06). |

startmethod | method for picking starting values for the optimization. Default is |

progbar | logical indicating whether a progress bar should be shown (the default is |

parallel | character string indicating whether parallel processing should be used (the default is |

ncpus | integer specifying the number of processes to use in the parallel processing. |

cl | optional snow cluster to use if |

plot | logical indicating whether the profile plot should be drawn after profiling is finished (the default is |

pch | plotting symbol to use. By default, a filled circle is used. See |

cline | logical indicating whether a horizontal reference line should be added to the plot that indicates the log-likelihood value corresponding to the 95% profile confidence interval (the default is |

xlab | title for the x-axis. If unspecified, the function tries to set an appropriate axis title. |

ylab | title for the y-axis. If unspecified, the function tries to set an appropriate axis title. |

main | title for the plot. If unspecified, the function tries to set an appropriate title. |

… | other arguments. |

The function fixes a particular variance component or correlation parameter of the model and then computes the maximized (restricted) log-likelihood over the remaining parameters of the model. By doing this for a range of values for the parameter that was fixed, a profile of the (restricted) log-likelihood is constructed.

For objects of class `"rma.uni"`

obtained with the `rma.uni`

function, the function profiles over parameter \(\tau^2\). If the model was fitted with `method="ML"`

or `method="REML"`

, the profiled (restricted) log-likelihood should be maximized at the ML/REML estimate of \(\tau^2\).

For objects of class `"rma.mv"`

obtained with the `rma.mv`

function, profiling is done by default over all (non-fixed) variance and correlation components of the model. Alternatively, one can use the `sigma2`

, `tau2`

, `rho`

, `gamma2`

, or `phi`

arguments to specify over which parameter the profiling should be done. Only one of these arguments can be used at a time. A single integer is used to specify the number of the parameter. Each profile plot should show a peak at the corresponding ML/REML estimate (the function checks whether any of the profiled log-likelihood values is larger than the log-likelihood of the fitted model, using a numerical tolerance of `lltol`

; if so, a warning is issued as this might indicate that the optimizer did not identify the actual ML/REML estimates). If the profiled likelihood is flat (over the entire parameter space or large portions of it), then this suggests that at least some of the parameters of the model are not identifiable (and the parameter estimates obtained are to some extent arbitrary).

Profiling requires repeatedly refitting the same model, which can be slow when \(k\) is large and/or the model is complex (the latter especially applies to `"rma.mv"`

objects). On machines with multiple cores, one can usually speed things up by delegating the model fitting to separate worker processes, that is, by setting `parallel="snow"`

or `parallel="multicore"`

and `ncpus`

to some value larger than 1. Parallel processing makes use of the `parallel`

package, using the `makePSOCKcluster`

and `parLapply`

functions when `parallel="snow"`

or using `mclapply`

when `parallel="multicore"`

(the latter only works on Unix/Linux-alikes). With `parallel::detectCores()`

, one can check on the number of available cores on the local machine. Note that argument `startmethod`

is ignored when using parallel processing and no progress bar will be shown.

An object of class `"profile.rma"`

. The object is a list (or list of lists) containing the following components:

values of \(\sigma^2\) over which the likelihood was profiled (only when profiling was actually done over \(\sigma^2\)).

values of \(\tau^2\) over which the likelihood was profiled (only when profiling was actually done over \(\tau^2\)).

values of \(\rho\) over which the likelihood was profiled (only when profiling was actually done over \(\rho\)).

values of \(\gamma^2\) over which the likelihood was profiled (only when profiling was actually done over \(\gamma^2\)).

values of \(\phi\) over which the likelihood was profiled (only when profiling was actually done over \(\phi\)).

(restricted) log-likelihood at the corresponding parameter value.

a matrix with the estimated model coefficients at the corresponding parameter value.

a matrix with the lower confidence interval bounds for the model coefficients at the corresponding parameter value.

a matrix with the upper confidence interval bounds for the model coefficients at the corresponding parameter value.

some additional elements/values.

Viechtbauer, W. (2010). Conducting meta-analyses in R with the metafor package. *Journal of Statistical Software*, **36**(3), 1--48. http://www.jstatsoft.org/v36/i03/.

### calculate log odds ratios and corresponding sampling variances dat <- escalc(measure="OR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg) ### random-effects model using rma.uni() res <- rma(yi, vi, data=dat) ### profile over tau^2 profile(res, progbar=FALSE)### change data into long format dat.long <- to.long(measure="OR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg) ### set levels of group variable ("exp" = experimental/vaccinated; "con" = control/non-vaccinated) levels(dat.long$group) <- c("exp", "con") ### set "con" to reference level dat.long$group <- relevel(dat.long$group, ref="con") ### calculate log odds and corresponding sampling variances dat.long <- escalc(measure="PLO", xi=out1, mi=out2, data=dat.long) ### bivariate random-effects model using rma.mv() res <- rma.mv(yi, vi, mods = ~ group, random = ~ group | study, struct="UN", data=dat.long) res#> #> Multivariate Meta-Analysis Model (k = 26; method: REML) #> #> Variance Components: #> #> outer factor: study (nlvls = 13) #> inner factor: group (nlvls = 2) #> #> estim sqrt k.lvl fixed level #> tau^2.1 2.6173 1.6178 13 no con #> tau^2.2 1.5486 1.2444 13 no exp #> #> rho.con rho.exp con exp #> con 1 0.9450 - no #> exp 0.9450 1 13 - #> #> Test for Residual Heterogeneity: #> QE(df = 24) = 5270.3863, p-val < .0001 #> #> Test of Moderators (coefficient 2): #> QM(df = 1) = 15.5470, p-val < .0001 #> #> Model Results: #> #> estimate se zval pval ci.lb ci.ub #> intrcpt -4.0960 0.4529 -9.0432 <.0001 -4.9837 -3.2082 *** #> groupexp -0.7414 0.1880 -3.9430 <.0001 -1.1099 -0.3729 *** #> #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #>### profile over tau^2_1, tau^2_2, and rho ### note: for rho, adjust region over which profiling is done ('zoom in' on area around estimate)# NOT RUN { par(mfrow=c(3,1)) profile(res, tau2=1) profile(res, tau2=2) profile(res, rho=1, xlim=c(.90, .98)) # }