[R] glmutli package assistance please

Bill Poling Bill@Poling @ending from zeli@@com
Thu Nov 15 19:00:18 CET 2018


Hello Michael, thank you for your responses.

I will have to look through the myriad of iterations of attempts at all this on this project but it seems to me that I tried that? Or tried to convert the integers to numeric and it errored out?

If not I certainly will do so and let know, thank you Sir!

WHP



From: Michael Dewey <lists using dewey.myzen.co.uk>
Sent: Thursday, November 15, 2018 7:24 AM
To: Bill Poling <Bill.Poling using zelis.com>; r-sig-mixed-models using r-project.org; r-help (r-help using r-project.org) <r-help using r-project.org>
Subject: Re: [R] glmutli package assistance please

Dear Bill

I am not sure what is going on here but I notice that 2 of your
covariates are numeric and 3 integer. What happens if you make them all
numeric?

Michael

On 15/11/2018 11:46, Bill Poling wrote:
> Hi, I have removed the pdf which was causing my e-mail to be blocked by moderators, my apologies.
>
> https://www.jstatsoft.org/article/view/v034i12/v34i12.pdf
>
> Original post:
>
> 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. ...{{dropped:13}}
>
> ______________________________________________
> mailto:R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

--
Michael
http://www.dewey.myzen.co.uk/home.html

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.


More information about the R-help mailing list