Skip to content

Commit e7bd556

Browse files
authored
Merge pull request #453 from davraam/v6.4.0-dev
update output call object to include actual formula
2 parents 182041b + e9663b9 commit e7bd556

1 file changed

Lines changed: 18 additions & 33 deletions

File tree

R/glmSLMADS.assign.R

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,25 @@
1818
#' @export
1919
glmSLMADS.assign <- function(formula, family, offsetName, weightsName, dataName){
2020

21-
#############################################################
22-
#MODULE 1: CAPTURE THE nfilter SETTINGS #
23-
thr <- dsBase::listDisclosureSettingsDS() #
24-
nfilter.tab <- as.numeric(thr$nfilter.tab) #
25-
nfilter.glm <- as.numeric(thr$nfilter.glm) #
26-
#nfilter.subset<-as.numeric(thr$nfilter.subset) #
27-
#nfilter.string<-as.numeric(thr$nfilter.string) #
28-
#############################################################
29-
30-
########################################
31-
############
32-
#Convert transmitable text for special link variance combinations back to full representation
33-
if(family=="quasigamma.link_log")
34-
{family<-"quasi(link=log,variance=mu^2)"}
35-
36-
if(family=="Gamma.link_log")
37-
{family<-"Gamma(link=log)"}
38-
#############
39-
40-
#Activate family object (this may not be necessary as character string may already be OK
41-
#but just checking
42-
final.family.object<-eval(parse(text=family))
43-
44-
45-
#Correctly name offset, weights and data objects in function call
46-
#(to allow glmPredict to work correctly later)
47-
calltext<-paste0("mg<-glm(formula,family=",family,",offset=",
48-
offsetName,",weights=",weightsName,",data=", dataName,",x=TRUE)")
49-
50-
eval(parse(text=calltext))
51-
52-
return(mg)
21+
# Convert transmitable text for special link variance combinations back to full representation
22+
if(family=="quasigamma.link_log")
23+
{family<-"quasi(link=log,variance=mu^2)"}
24+
25+
if(family=="Gamma.link_log")
26+
{family<-"Gamma(link=log)"}
27+
28+
# Correctly name offset, weights and data objects in function call
29+
# (to allow glmPredict to work correctly later)
30+
calltext <- paste0("mg<-glm(formula,family=",family,",offset=",
31+
offsetName,",weights=",weightsName,",data=", dataName,",x=TRUE)")
32+
33+
eval(parse(text=calltext))
34+
35+
# update the call object to include the actual formula
36+
mg$call$formula <- formula
37+
38+
return(mg)
5339

5440
}
55-
5641
# ASSIGN FUNCTION
5742
# glmSLMADS.assign

0 commit comments

Comments
 (0)