Skip to content

Commit 21fcb73

Browse files
authored
Merge pull request #259 from jr-leary7/dev
changed scale.fix to TRUE throughout -- related to #241
2 parents 87477fa + 990bee8 commit 21fcb73

9 files changed

+11
-17
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: scLANE
22
Type: Package
33
Title: Model Gene Expression Dynamics with Spline-Based NB GLMs, GEEs, & GLMMs
4-
Version: 0.8.5
4+
Version: 0.8.6
55
Authors@R: c(person(given = c("Jack", "R."), family = "Leary", email = "j.leary@ufl.edu", role = c("aut", "cre"), comment = c(ORCID = "0009-0004-8821-3269")),
66
person(given = "Rhonda", family = "Bacher", email = "rbacher@ufl.edu", role = c("ctb", "fnd"), comment = c(ORCID = "0000-0001-5787-476X")))
77
Description: Our scLANE model uses truncated power basis spline models to build flexible, interpretable models of single cell gene expression over pseudotime or latent time.

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Changes in v0.8.6
2+
3+
+ Changed GEE fitting to use `scale.fix = TRUE` throughout the package, as it appears to be faster and more statistically efficient based on simulated data benchmarking.
4+
15
# Changes in v0.8.5
26

37
+ Minor bug fixes.

R/backward_sel_WIC.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ backward_sel_WIC <- function(Y = NULL,
3737
id = id.vec,
3838
corstr = cor.structure,
3939
family = MASS::negative.binomial(theta.hat, link = "log"),
40+
scale.fix = TRUE,
4041
sandwich = sandwich.var)
4142
wald_stat <- unname(summary(fit)$wald.test[-1])^2
4243
} else {

R/marge2.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#' @param approx.knot (Optional) Should the set of candidate knots be subsampled in order to speed up computation? This has little effect on the final fit, but can improve computation time somewhat. Defaults to TRUE.
2727
#' @param n.knot.max (Optional) The maximum number of candidate knots to consider. Uses random sampling (don't worry, a random seed is set internally) to select this number of unique values from the reduced set of all candidate knots. Defaults to 50.
2828
#' @param glm.backend (Optional) Character specifying which GLM-fitting backend should be used. Must be one of "MASS" or "speedglm". Defaults to "MASS".
29-
#' @param gee.scale.fix (Optional) Boolean specifying whether the dispersion should be estimated from the data or held fixed at 1 when fitting in GEE mode. Defaults to FALSE.
3029
#' @param tols_score (Optional) The set tolerance for monitoring the convergence for the difference in score statistics between the parent and candidate model (this is the lack-of-fit criterion used for MARGE). Defaults to 0.00001.
3130
#' @param minspan (Optional) A set minimum span value. Defaults to NULL.
3231
#' @param return.basis (Optional) Whether the basis model matrix should be returned as part of the \code{marge} model object. Defaults to FALSE.
@@ -66,7 +65,6 @@ marge2 <- function(X_pred = NULL,
6665
approx.knot = TRUE,
6766
n.knot.max = 50,
6867
glm.backend = "MASS",
69-
gee.scale.fix = FALSE,
7068
tols_score = 1e-5,
7169
minspan = NULL,
7270
return.basis = FALSE,
@@ -838,7 +836,7 @@ marge2 <- function(X_pred = NULL,
838836
id = id.vec,
839837
family = MASS::negative.binomial(theta_hat, link = log),
840838
corstr = cor.structure,
841-
scale.fix = gee.scale.fix,
839+
scale.fix = TRUE,
842840
sandwich = sandwich.var)
843841
} else {
844842
if (glm.backend == "MASS") {

R/score_fun_gee.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ score_fun_gee <- function(Y = NULL,
9999
Sigma <- Sigma22 - temp_prod_1 - temp_prod_2 + temp_prod_3
100100
Sigma_inv <- try({ eigenMapMatrixInvert(Sigma, n_cores = 1L) }, silent = TRUE)
101101
if (inherits(Sigma_inv, "try-error")) {
102-
Sigma_inv <- MASS::ginv(Sigma)
102+
Sigma_inv <- eigenMapPseudoInverse(Sigma, n_cores = 1L)
103103
}
104104
temp_prod <- eigenMapMatMult(A = t(B.est),
105105
B = Sigma_inv,

R/stat_out_score_gee_null.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ stat_out_score_gee_null <- function(Y = NULL,
3636
data = NULL,
3737
corstr = cor.structure,
3838
family = MASS::negative.binomial(theta.hat),
39-
scale.fix = FALSE,
40-
sandwich = FALSE,
39+
scale.fix = TRUE,
40+
sandwich = FALSE,
4141
maxit = 10)
4242
alpha_est <- ests$alpha
4343
sigma_est <- ests$phi

R/testDynamic.R

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#' @param is.gee Should a GEE framework be used instead of the default GLM? Defaults to FALSE.
2626
#' @param cor.structure If the GEE framework is used, specifies the desired working correlation structure. Must be one of "ar1", "independence", or "exchangeable". Defaults to "ar1".
2727
#' @param gee.bias.correction.method (Optional) Specify which small-sample bias correction to be used on the sandwich variance-covariance matrix prior to test statistic estimation. Options are "kc" and "df". Defaults to NULL, indicating the use of the model-based variance.
28-
#' @param gee.scale.fix (Optional) Boolean specifying whether the dispersion should be estimated from the data or held fixed at 1 when fitting in GEE mode. Defaults to FALSE.
2928
#' @param is.glmm Should a GLMM framework be used instead of the default GLM? Defaults to FALSE.
3029
#' @param id.vec If a GEE or GLMM framework is being used, a vector of subject IDs to use as input to \code{\link[geeM]{geem}} or \code{\link[glmmTMB]{glmmTMB}}. Defaults to NULL.
3130
#' @param glmm.adaptive (Optional) Should the basis functions for the GLMM be chosen adaptively? If not, uses 4 evenly spaced knots. Defaults to TRUE.
@@ -64,7 +63,6 @@ testDynamic <- function(expr.mat = NULL,
6463
is.gee = FALSE,
6564
cor.structure = "ar1",
6665
gee.bias.correction.method = NULL,
67-
gee.scale.fix = FALSE,
6866
is.glmm = FALSE,
6967
glmm.adaptive = TRUE,
7068
id.vec = NULL,
@@ -188,7 +186,6 @@ testDynamic <- function(expr.mat = NULL,
188186
Y = expr.mat[lineage_cells, i],
189187
Y.offset = size.factor.offset[lineage_cells],
190188
is.gee = is.gee,
191-
gee.scale.fix = gee.scale.fix,
192189
id.vec = id.vec[lineage_cells],
193190
cor.structure = cor.structure,
194191
sandwich.var = ifelse(is.null(gee.bias.correction.method), FALSE, TRUE),
@@ -244,7 +241,7 @@ testDynamic <- function(expr.mat = NULL,
244241
data = null_mod_df,
245242
family = MASS::negative.binomial(theta_hat),
246243
corstr = cor.structure,
247-
scale.fix = gee.scale.fix,
244+
scale.fix = TRUE,
248245
sandwich = ifelse(is.null(gee.bias.correction.method), FALSE, TRUE))
249246
}, silent = TRUE)
250247
} else if (is.glmm) {

man/marge2.Rd

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

man/testDynamic.Rd

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

0 commit comments

Comments
 (0)