USCbiostats / fmcmc

A friendly MCMC framework
https://uscbiostats.github.io/fmcmc/
Other
16 stars 7 forks source link

Error in ...names() : could not find function "...names" #20

Open mgzjys opened 2 years ago

mgzjys commented 2 years ago

Hello developers,

Thank you for the wonderful work! I am trying to use your package but was faced with some issues. I installed the package and then run the demo code below:

library(fmcmc)
set.seed(78845)
n <- 1000
X <- rnorm(n)
y <- 3.0 + 2.0*X + rnorm(n, sd = 4)

ll <- function(p, X., y.) {

  joint_ll <- dnorm(y. - (p[1] + X.*p[2]), sd = p[3], log = TRUE)
  joint_ll <- sum(joint_ll)

  if (!is.finite(joint_ll))
    return(-Inf)

  joint_ll
}

set.seed(1215)
ans <- MCMC(
  ll,
  initial = c(0, 0, sd(y)),
  nsteps  = 5000,
  X.      = X,
  y.      = y
)

However, it gave me an error said "Error in ...names() : could not find function "...names"". I am using R 4.0.2 with RStudio to run the code. Can you help me with this? Thank you very much.

gvegayon commented 2 years ago

That happens because the function ...names() was introduced in R 4.1.0. I've changed the code so that it avoids using that function. Try it again and let me know.

kurokirasama commented 2 years ago

Hello, I have the same issue in both R package and git hub version... I'm using R version 3.6.3 in Ubuntu 20.04

kurokirasama commented 2 years ago

nevermind... i updated to R 4.1.2