|
18 | 18 | #' @export |
19 | 19 | glmSLMADS.assign <- function(formula, family, offsetName, weightsName, dataName){ |
20 | 20 |
|
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) |
53 | 39 |
|
54 | 40 | } |
55 | | - |
56 | 41 | # ASSIGN FUNCTION |
57 | 42 | # glmSLMADS.assign |
0 commit comments