From 42145c15f68eeddcd16b5cbce401aa2bcc0e5d5e Mon Sep 17 00:00:00 2001 From: livio Date: Sat, 20 Jan 2024 22:58:19 +0100 Subject: [PATCH] resid_std is stores as attribute of scores --- R/compute_scores.R | 1 + R/flipscores.R | 4 +++- R/utiliy_score_functions.R | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/R/compute_scores.R b/R/compute_scores.R index c39439e..0a7a7f4 100644 --- a/R/compute_scores.R +++ b/R/compute_scores.R @@ -172,6 +172,7 @@ compute_scores <- function(model0, model1,score_type = "standardized"){ attr(scores,"sd")=std_dev attr(scores,"scale_objects")=scale_objects attr(scores,"score_type")=score_type + attr(scores,"resid_std")=sqrtinvV_vect_times_residuals rownames(scores)=names(model0$fitted.values) return(scores) } \ No newline at end of file diff --git a/R/flipscores.R b/R/flipscores.R index 1a5386c..3e4b49d 100644 --- a/R/flipscores.R +++ b/R/flipscores.R @@ -187,9 +187,11 @@ flipscores<-function(formula, family, data, if(!is.null(flip_param_call$output_flips)&&flip_param_call$output_flips) model$flips=flip_param_call$flips flip_param_call$flips=NULL - names(nrm) <- names(std_dev) <- names(model$scores)<- names(model$Tspace) <- names(model$p.values) <-to_be_tested attr(model$scores,"nrm")=nrm attr(model$scores,"sd")=std_dev + attr(model$scores,"resid_std")=data.frame(lapply(results,function(x)attr(x[[1]]$scores,"resid_std"))) + names(attributes(model$scores)$resid_std) <-names(nrm) <- names(std_dev) <- names(model$scores)<- names(model$Tspace) <- names(model$p.values) <-to_be_tested + ### output model$call=fs_call diff --git a/R/utiliy_score_functions.R b/R/utiliy_score_functions.R index 55ce6e3..bddcb1d 100644 --- a/R/utiliy_score_functions.R +++ b/R/utiliy_score_functions.R @@ -158,6 +158,7 @@ socket_compute_flip <- function(scores,flip_param_call){ attributes(score1)$scale_objects=attributes(scores)$scale_objects[[id_col]] attributes(score1)$score_type=attributes(scores)$score_type attributes(score1)$sd=attributes(scores)$sd + attributes(score1)$resid_std=attributes(scores)$resid_std flip_param_call$scores=score1 res=eval(flip_param_call, parent.frame()) res$scores=score1