Hi, fellow statisticians! I am very new to R.
I am currently trying to learn to do dose-response meta-analysis using the command dosresmeta
. !
I used the dataset published by Shim et al
1598549085232|675x433
When I tried to test for non-linearity with the restricted cubic spline model, the commands returned error:
knots_bin <- quantile(databin$dose, c(.05, .35, .65, .95))
> spline <- dosresmeta(formula=logrr ~ rcs(dose, knots_bin), type=type, id=id, se=se, cases=cases, n=n, method="fixed", data=databin)
## This is the error code
Error in dosresmeta.fit(X[v != 0, , drop = FALSE], Z[v != 0, , drop = FALSE], :
A two-stage approach requires that each study provides at least p non-referent obs (p is the number of columns of the design matrix X)
note that databin
is the dataset I am using
I tried to look up to the [source code] for dosresmeta
, and the syntax states the following:
m <- length(unique(id))
k <- table(id)
p <- ncol(X)
q <- ncol(Z)
nay <- is.na(y)
n <- nrow(y)
nall <- sum(!nay)
## names for coefficient
np <- colnames(X)
if (is.null(np))
np <- paste("X", seq(p), sep = "")
nq <- colnames(Z)
if (is.null(nq))
nq <- paste("Z", seq(q), sep = "")
ny <- colnames(y)
if (is.null(ny))
ny <- "y"
ylist <- lapply(unique(id), function(j) y[id == j, ][!nay[j, ]])
Xlist <- lapply(unique(id), function(j) X[id == j, , drop = FALSE][
!nay[j, ], , drop = FALSE])
Zlist <- lapply(unique(id), function(j) Z[id == j, , drop = FALSE][
!nay[j, ], , drop = FALSE])
nalist <- lapply(unique(id), function(j) nay[id == j])
## This is the source code for the error
if (proc == "2stage"){
if (any(k < p)){
stop("A two-stage approach requires that each study provides at least p non-referent obs (p is the number of columns of the design matrix X)")
}
Does anyone know which part of my spline
command caused the error? I managed to do the command with one-stage process, but I think with this model, two-stage process is more appropriate.
Please help, any help will be much appreciated. Thank you very much
Best,