Coder Social home page Coder Social logo

Comments (5)

drizopoulos avatar drizopoulos commented on May 26, 2024

from jm.

yiexu avatar yiexu commented on May 26, 2024

I installed JM from github by following codes. Unfortunately, the problem remained. I restarted R and got no luck.
image
image

Please help. Thanks!

from jm.

drizopoulos avatar drizopoulos commented on May 26, 2024

from jm.

yiexu avatar yiexu commented on May 26, 2024

Problem solved. It works fine with R version 4.0.2.
Thanks for the great package!

from jm.

cytnjmu avatar cytnjmu commented on May 26, 2024

I think it is something related to how you extract the coefficients of the survreg object.
Previously, if you fit a model like this "init.fit <- survreg(Surv(Time, d) ~ ., data = SpD.i)"
you can use init.fit$coefs get the coeffcients, but now you have to use init.fit$coefficients to get the coefficients. If you revise this in the initial.surv function, the problem will be solved

if (method == "spline-PH-GH" || method == "spline-PH-Laplace") {
if (is.null(extra$strata)) {
dat <- data.frame(Time = Time, d = d, as.data.frame(WW))
rn <- tapply(row.names(dat), idT, tail, 1)
ind <- row.names(dat) %in% rn
dat <- dat[ind, ]
init.fit <- survreg(Surv(Time, d) ~ ., data = dat)
coefs <- init.fit$coef
xi <- 1 / init.fit$scale
phi <- exp(coefs[1])
logh <- -log(phi * xi * dat$Time^(xi - 1))
out$gammas.bs <- as.vector(lm.fit(extra$W2[ind, ], logh)$coefficients)
} else {
dat <- data.frame(Time = Time, d = d)
dat <- cbind(dat, as.data.frame(WW))
strata <- extra$strata
split.dat <- split(dat, strata)
gg <- NULL
for (i in seq_along(split.dat)) {
ii <- strata == levels(strata)[i]
SpD.i <- split.dat[[i]]
idT.i <- idT[ii]
W2.i <- extra$W2[ii, ]
rn <- tapply(row.names(SpD.i), idT.i, tail, 1)
ind <- row.names(SpD.i) %in% rn
SpD.i <- SpD.i[ind, ]
init.fit <- survreg(Surv(Time, d) ~ ., data = SpD.i)
coefs <- init.fit$coefficients # change coefs to coefficients
xi <- 1 / init.fit$scale
phi <- exp(coefs[1])
logh <- -log(phi * xi * SpD.i$Time^(xi - 1))
gg <- c(gg, as.vector(lm.fit(W2.i[ind, ], logh)$coefficients))
}
out$gammas.bs <- gg[!is.na(gg)]
}
out
}
}

from jm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.