Skip to content

Commit 69d4bb4

Browse files
committed
Update to glmSLMADS.assign
1 parent 8c83782 commit 69d4bb4

1 file changed

Lines changed: 13 additions & 28 deletions

File tree

R/glmSLMADS.assign.R

Lines changed: 13 additions & 28 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-
#############################################################
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)"}
2924

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)"}
25+
if(family=="Gamma.link_log")
26+
{family<-"Gamma(link=log)"}
3527

36-
if(family=="Gamma.link_log")
37-
{family<-"Gamma(link=log)"}
38-
#############
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)")
3932

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))
33+
eval(parse(text=calltext))
4334

35+
# update the call object to include the actual formula
36+
mg$call$formula <- formula
4437

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)
38+
return(mg)
5339

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

0 commit comments

Comments
 (0)