Skip to content

Commit 1219551

Browse files
jointSE(): add p-value column (closes #58)
Two-sided Wald p-values (2 * pnorm(-|est/SE|)) added for all fixed-effect and association parameters. Variance component rows (U_* and Residual) return NA since Wald tests are not appropriate for positive-constrained parameters. Updated @details and @return documentation accordingly.
1 parent 4fdf33c commit 1219551

3 files changed

Lines changed: 56 additions & 27 deletions

File tree

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
* `joint()` and `jointSE()` arguments `gpt`, `lgpt`, `max.it`, and `tol` now have explicit default values in the function signatures, replacing the previous `missing()` pattern. Defaults are visible in auto-complete and `?joint`.
1616

17+
* `jointSE()` output now includes a `p-value` column containing two-sided Wald p-values for all fixed-effect and association parameters. Variance component rows (`U_*`, `Residual`) return `NA` as Wald tests are not appropriate for positive-constrained parameters. Closes #58.
18+
1719
* `simjoint()` no longer prints a progress line via `cat()` from the internal `simdat()` function. It now emits a `message()` at the `simjoint()` level, which can be suppressed with `suppressMessages()`.
1820

1921
* `survival` has been moved from `Depends` to `Imports`. `Surv` is re-exported so existing user code does not require changes.

R/jointSE.R

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,20 @@
2222
#' longitudinal and survival data. It is rare that more than 200 bootstrap
2323
#' samples are needed for estimating a standard error. The number of bootstrap
2424
#' samples needed for accurate confidence intervals can be as large as 1000.
25+
#' Two-sided Wald p-values are computed as \eqn{2\Phi(-|\hat\theta /
26+
#' \widehat{SE}|)} for all fixed-effect and association parameters. P-values
27+
#' are \code{NA} for variance components (\code{U_*} and \code{Residual})
28+
#' because Wald tests are not appropriate for variance parameters constrained
29+
#' to be positive.
2530
#'
2631
#' @author Ruwanthi Kolamunnage-Dona and Pete Philipson
2732
#' @keywords models survival htest
2833
#' @seealso \code{\link[nlme]{lme}}, \code{\link[survival]{coxph}},
2934
#' \code{\link{joint}}, \code{\link{jointdata}}.
3035
#'
31-
#' @return An object of class \code{data.frame}.
36+
#' @return An object of class \code{data.frame} with columns \code{Component},
37+
#' \code{Parameter}, \code{Estimate}, \code{SE}, \code{p-value},
38+
#' \code{95\%Lower}, and \code{95\%Upper}.
3239
#' @export
3340
#'
3441
#' @references
@@ -199,19 +206,32 @@ jointSE <- function(
199206
}
200207

201208
b1 <- data.frame(compnames, paranames)
209+
210+
# Two-sided Wald p-values for fixed effects and association parameters.
211+
# Variance component rows (U_* and Residual) get NA: a Wald test is not
212+
# meaningful for variance parameters constrained to be positive.
213+
n_var <- q + 1 # number of variance rows (random effects + residual)
214+
n_fixed <- length(paranames) - n_var
215+
pval <- c(
216+
2 * pnorm(-abs(mles[seq_len(n_fixed)] / se[seq_len(n_fixed)])),
217+
rep(NA_real_, n_var)
218+
)
219+
202220
b1 <- cbind(
203221
b1,
204222
round(mles, 4),
205223
round(cbind(se), 4),
224+
round(pval, 4),
206225
round(ci1, 4),
207226
round(ci2, 4)
208227
)
209228

210-
colnames(b1)[1:6] <- c(
229+
colnames(b1)[1:7] <- c(
211230
"Component",
212231
"Parameter",
213232
"Estimate",
214233
"SE",
234+
"p-value",
215235
"95%Lower",
216236
"95%Upper"
217237
)

man/jointSE.Rd

Lines changed: 32 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)