[R] glmutli

Bill Poling Bill@Poling @ending from zeli@@com
Wed Nov 14 19:30:23 CET 2018


Hello. I am still trying to get some of the examples in this glmulti pdf to work with my data.

I have sent e-mails to author addresses provided but no response or bounced back as in valid.

I am not sure if this is more likely to receive support on r-help or r-sig-mixed-models, hence the double posting, my apologies in advance.

I am windows 10 -- R3.5.1 -- RStudio Version 1.1.456

glmulti: An R Package for Easy Automated Model Selection with (Generalized) Linear Models

pdf Attached:

On page 13 section 3.1 of the pdf they describe a routine to estimate the candidate models possible.

Their data description:
The number of levels factors have does not affect the number of candidate models, only
their complexity. We use a data frame dod, containing as a first column a dummy response
variable, the next 6 columns are dummy factors with three levels, and the last six are dummy
covariates.
To compute the number of candidate models when there are between 1 and 6 factors and 1
and 6 covariates, we call glmulti with method = "d" and data = dod. We use names(dod)
to specify the names of the response variable and of the predictors. We vary the number of
factors and covariates, this way:


Their routine:
dd <- matrix(nc = 6, nr = 6) for(i in 1:6) for(j in 1:6) dd[i, j] <- glmulti(names(dod)[1],
+ names(dod)[c(2:(1 + i), 8:(7 + j))], data = dod, method = "d")

My data, I organized it similar to the example, Response, Factor, Factor, 5 covariates

Classes 'data.table' and 'data.frame':23141 obs. of  8 variables:
 $ Editnumber2    : num  0 0 1 1 1 1 1 1 1 1 ...
 $ PatientGender  : Factor w/ 3 levels "F","M","U": 1 1 2 2 2 2 1 1 1 1 ...
 $ B1             : Factor w/ 14 levels "Z","A","C","D",..: 2 2 3 3 2 2 2 2 2 2 ...
 $ SavingsReversed: num  -0.139 -0.139 -0.139 -0.139 -0.139 ...
 $ productID      : int  3 3 3 3 3 3 3 3 1 1 ...
 $ ProviderID     : int  113676 113676 113964 113964 114278 114278 114278 114278 114278 114278 ...
 $ ModCnt         : int  0 0 0 0 1 1 1 1 1 1 ...
 $ B2             : num  -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
 - attr(*, ".internal.selfref")=<externalptr>

Trying to follow what they did, my routine, Editnumber2 is the response variable:

dd <- matrix(nc = 2, nr = 5)
for(i in 1:2) for(j in 1:5) dd[i, j] <- glmulti(names(r1)[1], names(r1)[c(2:(1 + i), 7:(6 + j))], data = r1, method = "d")

The error: Error in terms.formula(formula, data = data) :
  invalid model formula in ExtractVars

I have tried changing the numbers around but get results like this:

Initialization...
TASK: Diagnostic of candidate set.
Sample size: 23141
2 factor(s).
2 covariate(s). <--appears to be missing 3 of the covariates for some reason?
0 f exclusion(s).
0 c exclusion(s).
0 f:f exclusion(s).
0 c:c exclusion(s).
0 f:c exclusion(s).
Size constraints: min =  0 max = -1
Complexity constraints: min =  0 max = -1
Your candidate set contains 250 models.
Error in `[<-`(`*tmp*`, i, j, value = glmulti(names(r1)[1], names(r1)[c(2:(1 +  :
  subscript out of bounds


I hope someone can help straighten out my code, thank you.


WHP



Confidentiality Notice This message is sent from Zelis. This transmission may contain information which is privileged and confidential and is intended for the personal and confidential use of the named recipient only. Such information may be protected by applicable State and Federal laws from this disclosure or unauthorized use. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any disclosure, review, discussion, copying, or taking any action in reliance on the contents of this transmission is strictly prohibited. If you have received this transmission in error, please contact the sender immediately. Zelis, 2018.




This message was secured by Zix(R).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: glmutli.pdf
Type: application/pdf
Size: 1191543 bytes
Desc: glmutli.pdf
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20181114/4c55dbcc/attachment-0001.pdf>


More information about the R-help mailing list