Skip to content

Commit

Permalink
updts
Browse files Browse the repository at this point in the history
  • Loading branch information
federicorotolo committed Dec 13, 2017
1 parent 90de640 commit ea346b0
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 1,384 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
^\.Rproj\.user$
vignette\surrosurv.Rnw
vignette\surrosurv.bbl
vignette\Sweave.sty
vignette\surrosurv.log
vignette\surrosurv.syntex.gz
^\.travis\.yml$
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Package: surrosurv
Type: Package
Title: Evaluation of Failure Time Surrogate Endpoints in Individual Patient Data
Meta-Analyses
Version: 1.1.23
Date: 2017-08-16
Version: 1.1.25
Date: 2017-12-13
Authors@R: c(
person("Federico", "Rotolo", email="[email protected]",
role=c("aut", "cre")),
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ S3method(print, conv)
S3method(loocv, data.frame)

S3method(confint, surrosurv)
S3method(convals, surrosurv)
S3method(convergence, surrosurv)
S3method(loocv, surrosurv)
S3method(predict, surrosurv)
S3method(print, surrosurv)
Expand Down
38 changes: 20 additions & 18 deletions R/convergence.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#####################################################################################
#####################################################################################
#####################################################################################
convals <- function(x) {
if (!'surrosurv' %in% class(x))
stop('x must be of class surrosurv')

# ---------------------------------------------------------------------------- #
convals <- function(x, ...) UseMethod('convals')
# ---------------------------------------------------------------------------- #

# ---------------------------------------------------------------------------- #
convals.surrosurv <- function(x, ...) {
models <- c('Clayton', 'Plackett', 'Hougaard', 'Poisson')
models <-
models[sapply(models, function(y)
Expand Down Expand Up @@ -82,27 +81,30 @@ convals <- function(x) {
class(fitRES) <- 'conv'
return(fitRES)
}
# ---------------------------------------------------------------------------- #

#####################################################################################
#####################################################################################
#####################################################################################
convergence <- function(x, kkttol = 1e-2, kkt2tol = 1e-8) {
if (!'surrosurv' %in% class(x))
stop('x must be of class surrosurv')


# ---------------------------------------------------------------------------- #
convergence <- function(x, kkttol = 1e-2, kkt2tol = 1e-8, ...)
UseMethod('convergence')
# ---------------------------------------------------------------------------- #


# ---------------------------------------------------------------------------- #
convergence.surrosurv <- function(x, kkttol = 1e-2, kkt2tol = 1e-8, ...) {
ConvRES <- convals(x)
checkConvRES <- cbind(ConvRES[, 1, drop = FALSE] <= kkttol,
ConvRES[, 2:3] > kkt2tol)

class(checkConvRES) <- 'conv'
return(checkConvRES)
}
# ---------------------------------------------------------------------------- #

#####################################################################################
#####################################################################################
#####################################################################################

# ---------------------------------------------------------------------------- #
print.conv <- function(x, na.print = '---', ...) {
class(x) <- 'matrix'
print(x, na.print = na.print, ...)
}
}
# ---------------------------------------------------------------------------- #
9 changes: 7 additions & 2 deletions man/convergence.Rd
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
\name{convergence}
\alias{convergence}
\alias{convergence.surrosurv}
\alias{convals}
\alias{convals.surrosurv}
\title{
Assesses the convergence of fitted models for surrogacy evaluation
}
Expand All @@ -13,8 +15,8 @@
are positive definite.
}
\usage{
convals(x)
convergence(x, kkttol = 1e-2, kkt2tol = 1e-8)
\method{convals}{surrosurv}(x, ...)
\method{convergence}{surrosurv}(x, kkttol = 1e-2, kkt2tol = 1e-8, ...)
}
\arguments{
\item{x}{
Expand All @@ -31,6 +33,9 @@
are positive definite.
The threshold is for the minimum of the eigenvalues.
}
\item{...}{
Further parameters (not implemented)
}
}

\value{
Expand Down
53 changes: 0 additions & 53 deletions vignettes/Sweave.sty

This file was deleted.

Binary file modified vignettes/surrosurv.pdf
Binary file not shown.
Loading

0 comments on commit ea346b0

Please sign in to comment.