Re: [R] non-reproducible eigen() output with MKL

2025-05-05 Thread Viechtbauer, Wolfgang (NP)
A relevant thread from a few years ago where this was discussed: https://www.stat.math.ethz.ch/pipermail/r-help/2023-August/477904.html I generally use: export OPENBLAS_NUM_THREADS=1 export MKL_NUM_THREADS=1 since in my experience the biggest performance gains come from switching to OpenBLAS /

Re: [R] how to specify uncorrelated random effects in nlme::lme()

2024-01-09 Thread Viechtbauer, Wolfgang (NP)
Dear Zhen, You can use this with pdDiag(). An example: library(nlme) res <- lme(distance ~ age*Sex, random = list(Subject = pdDiag(~ age)), data=Orthodont) summary(res) Best, Wolfgang > -Original Message- > From: R-help On Behalf Of ?? > Sent: Monday, January 8, 2024 12:43 > To: R-hel

Re: [R] Try reproduce glmm by hand

2023-12-03 Thread Viechtbauer, Wolfgang (NP)
Dear Marc, Plugging the BLUPs into the likelihood isn't going to give you the ll of the model. You need to integrate over the random effect. intfun <- function(nu, xi, mi, pred, theta) dbinom(xi, xi+mi, plogis(nu)) * dnorm(nu, pred, theta) lli <- rep(NA, nrow(df)) for (i in 1:nrow(df)) {

Re: [R] MASS::mvrnorm() on MKL may produce different numbers even when the seed is the same?

2023-08-17 Thread Viechtbauer, Wolfgang (NP)
Ah, super interesting! Thanks for the pointer, Bill. I might not have seen the issue because I have export MKL_NUM_THREADS=1 in my .profile, so MKL never goes beyond using one thread on my machine. That's a potential source of non-reproducibility I have not come across. So the 'wisdom' that on

Re: [R] MASS::mvrnorm() on MKL may produce different numbers even when the seed is the same?

2023-08-17 Thread Viechtbauer, Wolfgang (NP)
But I have never seen a case where, on the same machine and using the same math routines, using the same seed repeatedly generated different values. That is quite bizarre (the issue I was discussing in the thread is quite simple in comparison). I tried to reproduce the issue below, but was unabl

Re: [R] Variable and value labels

2023-07-12 Thread Viechtbauer, Wolfgang (NP)
For value labels, factor() provides the necessary machinery. For variable labels, one could make use of comment() (something that not too many people seem to know about). To illustrate: # look at the mtcars dataset mtcars # turn 'am' into a factor and use labels for the two possible levels ther

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-31 Thread Viechtbauer, Wolfgang (NP)
How about using the same 'mar' for all plots, but adding an outer margin? DAX <- EuStockMarkets[, 'DAX'] DAX. <- cbind(DAX, diff(log(DAX)), diff(diff(log(DAX colnames(DAX.) <- c("DAX", 'vel (%)', 'accel (%)') head(DAX.) par(mfrow=c(3,1), mar=c(1,4.5,0,2), oma=c(3,0,1,0)) plot(DAX.[, 1], log=

Re: [R] foreign package: unable to read S-Plus objects

2023-01-17 Thread Viechtbauer, Wolfgang (NP)
@Joe: I have S-Plus 6.0 ("Professional Edition Version 6.0.3 Release 2 for Microsoft Windows : 2001") running here and can't load them there either. Tried simdat and S-Plus apparently thinks it is a script and then you just get a garbled up mess. Tried to change it to simdat.sdd and a few other