如何解决n%*%s中的错误错误:需要数字/复杂矩阵/向量参数
library(foreign)
library(discSurv)
library(mgcv)
library(gamlss.mx)
library(mgcv)
library(MASS)
library(nlme)
library(glmmLasso)
attach(dataset)
AFI <- NULL
CNS <- NULL
for (i in 1:length(AFA)) {
AFI[i] <- ifelse(is.na(AFA[i]) == TRUE, Age[i], AFA[i])
CNS[i] <- ifelse(is.na(AFA[i]) == TRUE, 0, 1)
}
dataset <- data.frame(cbind(dataset, AFI, CNS))
dtLong <-
as.data.frame(dataLong (
dataSet = dataset,
timeColumn = "AFI",
censColumn = "CNS"
))
glm1 <-
glmmLasso(
y ~ as.factor(timeInt) + as.factor(Sex) + as.factor(MaritalS) ,
family = binomial(link = logit),
data = dtLong,
lambda = 5,
switch.NR = T,
final.re = TRUE
)
数据在
上给出[https://drive.google.com/drive/folders/1o4kgsXvmsZrEkqvZAo3o0dgLBOB58YN5]