Re: [R] metafor rma.mv weights questions

2017-02-02 Thread Viechtbauer Wolfgang (SP)
Hi Laura, As far as I am concerned, you account for multiple effects sizes from the same study by setting up and fitting an appropriate model, not by fiddling with the weights. Several examples are described here:

Re: [R] Metafor multilevel metaregression: total variance increases when moderator added?

2017-02-28 Thread Viechtbauer Wolfgang (SP)
Very difficult to diagnose what is going on without actually seeing the data. But as I said on CV: Depending on the data, the variance components may not be estimated precisely, so negative values for those kinds of pseudo-R^2 statistics are quite possible. In fact, if a particular moderator is

Re: [R] matafor package - categorical moderator interpretation question

2017-04-04 Thread Viechtbauer Wolfgang (SP)
You are not conducting a proper test of the moderator. When you use 'mods = ~factor(sample_data$Participants) - 1', the model does not include an intercept term but dummy variables corresponding to all levels of the moderator. The omnibus test you are getting therefore tests the null hypothesis

Re: [R] Change Rcode for a meta-analysis(netmeta) to use a random effects model instead of a mixed effects model

2017-06-29 Thread Viechtbauer Wolfgang (SP)
The code in your mail in a mangled mess, since you posted in HTML. Please configure your email client to send emails in plain text. Could you explain what exactly you mean by "Currently it is using a mixed effects model. Is it possible to change the code so a random effects model is used?"

Re: [R] R-3.4.0 and survival_2.41-3 ..

2017-04-25 Thread Viechtbauer Wolfgang (SP)
Sort of an obvious approach, but after every upgrade (regardless if it is major/minor), I just delete my entire personal library and reinstall everything from scratch. For this, I have a script that includes just a bunch of install.packages() calls. Like: install.packages(c("lme4", "glmmML",

Re: [R] adding predictor to linear model without changing existing coefficients

2017-05-17 Thread Viechtbauer Wolfgang (SP)
You could use an offset term. An example: n <- 100 x1 <- rnorm(n) x2 <- rnorm(n) x3 <- rnorm(n) y <- 0 + .2 * x1 - .5 * x2 + .3 * x3 + rnorm(n) res1 <- lm(y ~ x1 + x2) summary(res1) res2 <- lm(y ~ 1 + offset(coef(res1)[2] * x1 + coef(res1)[3] * x2)) summary(res2) ### identical intercept as in

Re: [R] Classic fail-safe N

2017-06-26 Thread Viechtbauer Wolfgang (SP)
I would suggest to post this to the (recently created) R-sig-meta-analysis mailing list. See: https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis Best, Wolfgang >-Original Message- >From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Naike Wang >Sent: Monday, June 26,

[R] xyTable(x,y) versus table(x,y) with NAs

2017-12-12 Thread Viechtbauer Wolfgang (SP)
Hi All, It seems to me that xyTable() gets thrown off by NAs: x <- c(1, 1, 2, 2, 2, 3) y <- c(1, 2, 1, 3, NA, 3) table(x, y, useNA="always") xyTable(x, y) Is this intended behavior? Best, Wolfgang __ R-help@r-project.org mailing list -- To

[R] Combine by columns a vector with another vector that is constant across rows

2018-07-03 Thread Viechtbauer, Wolfgang (SP)
Hi All, I have one vector that I want to combine with another vector and that other vector should be the same for every row in the combined matrix. This obviously does not work: vec <- c(2,4,3) cbind(1:5, vec) This does, but requires me to specify the correct value for 'n' in replicate():

Re: [R] Codes to conduct network meta-analysis, gemtc package

2018-02-15 Thread Viechtbauer Wolfgang (SP)
This aside, there is the R-sig-meta-analysis mailing list where this probably belongs: https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis Best, Wolfgang >-Original Message- >From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Bert >Gunter >Sent: Thursday, 15

Re: [R] Combine by columns a vector with another vector that is constant across rows

2018-07-03 Thread Viechtbauer, Wolfgang (SP)
--Original Message- >From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us] >Sent: Tuesday, 03 July, 2018 17:48 >To: r-help@r-project.org; Viechtbauer, Wolfgang (SP); r-help@r- >project.org >Subject: Re: [R] Combine by columns a vector with another vector that is >consta

Re: [R] R and factorytalk historian

2018-12-12 Thread Viechtbauer, Wolfgang (SP)
Dear Petr, Sorry, no experience with the FTH, but related to this, has anybody gotten R to interface nicely with the Retro Encabulator, providing live read outs of the synchronizing cardinal grammeters? (my apologies, I just couldn't resist) Best, Wolfgang >-Original Message- >From:

Re: [R] meta analysis for sensitivity and specificity

2018-12-07 Thread Viechtbauer, Wolfgang (SP)
Dear Greg, I am not sure if I understand your question. If you are asking how to do this in R, then one could use the metafor or meta package for this. The specificity and sensitivity values are proportions, so one would usually meta-analyze them after a logit transformation. But all of the

[R] Substitution in expressions

2019-03-26 Thread Viechtbauer, Wolfgang (SP)
Hi All, I am trying to create a vector of expressions, where the elements in the expressions are contained in other vectors (i.e., they should be substituted). I made some attempts with substitute() and bquote(), but couldn't get this to work. My solution so far is: base <- 1:5 expo <-

Re: [R] Substitution in expressions

2019-03-26 Thread Viechtbauer, Wolfgang (SP)
, 2019 14:42 To: Viechtbauer, Wolfgang (SP) Cc: r-help mailing list Subject: Re: [R] Substitution in expressions Er, I'm confused. You post some code, the code does something. In which sense is this not what you want? This is slightly more direct: > mapply(function(x,y) as.expression(bquote(

Re: [R] Substitution in expressions

2019-03-26 Thread Viechtbauer, Wolfgang (SP)
Ok, thanks. Happy to stick with mapply() then. Best, Wolfgang -Original Message- From: peter dalgaard [mailto:pda...@gmail.com] Sent: Tuesday, 26 March, 2019 15:40 To: Viechtbauer, Wolfgang (SP) Cc: r-help mailing list Subject: Re: [R] Substitution in expressions I think mapply

Re: [R] Substitution in expressions

2019-03-26 Thread Viechtbauer, Wolfgang (SP)
Hi Bert, I am indeed creating a mathematical expression, but ?plotmath doesn't cover how to do such a vectorized substitution. Best, Wolfgang -Original Message- From: Bert Gunter [mailto:bgunter.4...@gmail.com] Sent: Tuesday, 26 March, 2019 15:52 To: Viechtbauer, Wolfgang (SP) Cc: r

Re: [R] Substitution in expressions

2019-03-26 Thread Viechtbauer, Wolfgang (SP)
Gunter [mailto:bgunter.4...@gmail.com] Sent: Tuesday, 26 March, 2019 17:43 To: Viechtbauer, Wolfgang (SP) Cc: r-help mailing list Subject: Re: [R] Substitution in expressions Perhaps something like this (apologies if beating a dead horse): plot(NA,NA, xlim = c(-1,5),ylim = c(-1,5), xlab = "&q

Re: [R] differences between meat and metafor packages

2019-02-25 Thread Viechtbauer, Wolfgang (SP)
The second argument (called 'vi') in rma() is for the variances. If you have SEs, then use the 'sei' argument: res <- rma(HR, sei=SE, data=a) Best, Wolfgang -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of greg holly Sent: Monday, 25 February, 2019

Re: [R] differences between meat and metafor packages

2019-02-27 Thread Viechtbauer, Wolfgang (SP)
hod="REML", slab=paste(a$study), digits=3) Best, Wolfgang -Original Message- From: greg holly [mailto:mak.hho...@gmail.com] Sent: Monday, 25 February, 2019 21:20 To: Viechtbauer, Wolfgang (SP) Subject: Re: [R] differences between meat and metafor packages Hi

Re: [R] Conditional Logistic Regression with Multilevel Data [using clogistic() in Epi and lmer() in lme4???]

2019-07-03 Thread Viechtbauer, Wolfgang (SP)
Dear Heather, You can do this with clogit() from the 'survival' package, using strata(). See: http://www.metafor-project.org/doku.php/tips:clogit_paired_binary_data You can also use lme4::glmer(), glmmML::glmmML(), or metafor::rma.glmm() for that. [1] [1] Rerunning this example, I noticed a

Re: [R] I am struggling with contrasts

2020-03-10 Thread Viechtbauer, Wolfgang (SP)
Dear John, The linearHypothesis() function from the 'car' package does this. >From the help file: "The value of the linear hypothesis and its covariance >matrix are returned respectively as "value" and "vcov" attributes of the >object (but not printed)." For a single linear combination, vcov

[R] [R-pkgs] mathjaxr: Using 'Mathjax' in Rd Files

2020-05-09 Thread Viechtbauer, Wolfgang (SP)
Dear All, I would like to announce the release of the 'mathjaxr' package: https://cran.r-project.org/package=mathjaxr The package provides MathJax and a handful of macros to enable its use within Rd files for rendering equations in the HTML help files. Package authors wanting to make use of

Re: [R] Error message in meta-analysis package Metafor-weights =""

2020-06-23 Thread Viechtbauer, Wolfgang (SP)
Dear Kobby, Please post the output of sessionInfo() and class(result.md). Best, Wolfgang >-Original Message- >From: K Amoatwi [mailto:amoatwi...@gmail.com] >Sent: Monday, 22 June, 2020 22:30 >To: Viechtbauer, Wolfgang (SP) >Cc: r-help@r-project.org >Subject: Re:

Re: [R] Error message in meta-analysis package Metafor-weights =""

2020-06-23 Thread Viechtbauer, Wolfgang (SP)
il.com] >Sent: Tuesday, 23 June, 2020 16:37 >To: Viechtbauer, Wolfgang (SP) >Cc: r-help@r-project.org >Subject: Re: [R] Error message in meta-analysis package Metafor-weights ="" > >Dear Wolfgang, >I have posted the requested information you askedĀ for. > >&g

Re: [R] Error message in meta-analysis package Metafor-weights =""

2020-06-16 Thread Viechtbauer, Wolfgang (SP)
Dear Amoatwi, This way of using the escalc() function has been deprecated. It might be added back once there is actually any benefit from having this functionality, but for years it just meant that I had to maintain two different ways of doing the exact same thing without any additional

Re: [R] roxygen2 & markdown & math

2021-01-12 Thread Viechtbauer, Wolfgang (SP)
Dear Sigbert, The mathjaxr package provides this: https://cran.r-project.org/package=mathjaxr https://github.com/wviechtb/mathjaxr Best, Wolfgang >-Original Message- >From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Sigbert >Klinke >Sent: Tuesday, 12 January, 2021 9:14

[R] Monospaced font not shown correctly (Xubuntu 20.04)

2021-01-19 Thread Viechtbauer, Wolfgang (SP)
Hi all, On my system (Xubuntu 20.04), using par(family="mono") is not rendered correctly. The same issue was raised here: https://stackoverflow.com/questions/64207220/rendering-plot-in-r-with-mono-spaced-family-font-does-not-display-characters-any Using par(family="monospace") does work:

Re: [R] Monospaced font not shown correctly (Xubuntu 20.04)

2021-01-20 Thread Viechtbauer, Wolfgang (SP)
R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Viechtbauer, >Wolfgang (SP) >Sent: Wednesday, 20 January, 2021 9:44 >To: Paul Murrell; r-help@r-project.org >Subject: Re: [R] Monospaced font not shown correctly (Xubuntu 20.04) > >Dear Paul, > >Thanks for the helpful repl

Re: [R] Monospaced font not shown correctly (Xubuntu 20.04)

2021-01-20 Thread Viechtbauer, Wolfgang (SP)
/DejaVuSansMono.ttf Substitute your favorite (ttf/otf) monospaced font above. Best, Wolfgang >-Original Message- >From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Viechtbauer, >Wolfgang (SP) >Sent: Wednesday, 20 January, 2021 10:10 >To: Paul Mu

Re: [R] Monospaced font not shown correctly (Xubuntu 20.04)

2021-01-20 Thread Viechtbauer, Wolfgang (SP)
-*-*-%d-*-*-*-*-*-*-*") X11(family="mono") plot(1) Best, Wolfgang >-Original Message- >From: Paul Murrell [mailto:p...@stat.auckland.ac.nz] >Sent: Wednesday, 20 January, 2021 0:37 >To: Viechtbauer, Wolfgang (SP); r-help@r-project.org >Subject: Re: [R] M

Re: [R] about a p-value < 2.2e-16

2021-03-19 Thread Viechtbauer, Wolfgang (SP)
Dear Jiefei, This behavior is documented. From help(wilcox.test): "By default (if exact is not specified), an exact p-value is computed if the samples contain less than 50 finite values and there are no ties. Otherwise, a normal approximation is used." Best, Wolfgang >-Original

Re: [R] forest plot -metafor package

2021-03-22 Thread Viechtbauer, Wolfgang (SP)
Dear Usmle Ck, This is what the 'slab' argument is for (for adding 'study labels'). For an example, see: https://www.metafor-project.org/doku.php/plots:forest_plot Best, Wolfgang >-Original Message- >From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Usmle Ck >Sent:

Re: [R] about a p-value < 2.2e-16

2021-03-19 Thread Viechtbauer, Wolfgang (SP)
message: In wilcox.test.default(c(1, 3, 2, 2, 4), exact = TRUE) : cannot compute exact p-value with ties Best, Wolfgang >-Original Message- >From: Jiefei Wang [mailto:szwj...@gmail.com] >Sent: Friday, 19 March, 2021 16:32 >To: Viechtbauer, Wolfgang (SP) >Cc: r-help >Subject:

Re: [R] evil attributes

2021-04-12 Thread Viechtbauer, Wolfgang (SP)
>-Original Message- >From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] >Sent: Monday, 12 April, 2021 1:58 >To: Viechtbauer, Wolfgang (SP); R-help >Subject: Re: [R] evil attributes > >On 11/04/2021 2:46 p.m., Viechtbauer, Wolfgang (SP) wrote: >> The is.vector

Re: [R] Stata/Rstudio evil attributes

2021-04-10 Thread Viechtbauer, Wolfgang (SP)
Dear Roger, The problem is this. qss() looks like this: if (is.matrix(x)) { [...] } if (is.vector(x)) { [...] } qss Now let's check these if() statements: is.vector(B$x) # TRUE is.vector(D$x) # FALSE is.matrix(B$x) # FALSE is.matrix(D$x) # FALSE is.vector(D$x) being FALSE may be

Re: [R] evil attributes

2021-04-11 Thread Viechtbauer, Wolfgang (SP)
The is.vector() thing has also bitten me in the behind on a few occasions. When I want to check if something is a vector, allow for it to possibly have some additional attributes (besides names) that would make is.vector() evaluate to FALSE, but evaluate to FALSE for lists (since

Re: [R] Creating NA equivalent

2021-12-21 Thread Viechtbauer, Wolfgang (SP)
Hi Chris, The survival package provides machinery for handling censored observations. Whether time is censored or some other type of variable (e.g., viral load due to some lower detection limit) does not make a fundamental difference. In fact, the type of model you are thinking of with 2) is a

Re: [R] Creating NA equivalent

2021-12-21 Thread Viechtbauer, Wolfgang (SP)
odels. Just explore these packages to see what they can do. Best, Wolfgang >-Original Message- >From: Chris Evans [mailto:chrish...@psyctc.org] >Sent: Tuesday, 21 December, 2021 12:56 >To: Viechtbauer, Wolfgang (SP) >Cc: r-help@r-project.org >Subject: Re: Creating NA equ

[R] Using update() within a function with a changed formula

2021-11-13 Thread Viechtbauer, Wolfgang (SP)
Hello all, Say I would like to change the outcome in a formula to a variable not part of the original dataset. This works just fine: res <- lm(mpg ~ wt + cyl, data=mtcars) res y <- rnorm(nobs(x)) update(x, formula = y ~ .) But not when doing so within a function: rm(y) f <- function(x) {

Re: [R] Can browseURL open a lynx browser?

2022-03-20 Thread Viechtbauer, Wolfgang (SP)
Dear Ashim, If you really want to use lynx, then you need to open up a new terminal to make this work. For example, this will do: browseURL("http://www.r-project.org","xterm -e lynx") But this will open up a new terminal for each call to browseURL(). Best, Wolfgang >-Original