I need to perform a log binomial regression using GEE. I tried to solve this using gee package with the following code:
gee(y~x,id,data = data, family="binomial",link="log",corstr="exchangeable")
Where y is a binary variable 0/1.
When I run that, i got this error:
Error in gee(y~x,id,data = data, family="binomial",link="log",corstr="exchangeable") :
unused argument (link = "log")
I know that the error is straightforward, however, I don't know how to specify the link function inside the gee function. The problem is that the binary outcome is more than 50%. Because of that, OR is not a good proxy for risk interpretation.
Please help.
Related
I am trying to estimate relative risk using log-binomial model using the glm function. Although it works well with univariable analysis, it gives me an error message when I add multiple variables
This is the error message I get
Error: no valid set of coefficients has been found: please supply starting values.
I did some search but couldn't find a way to solve this issue
Thanks
This error can happen for one of two reasons. First, if any of the deviances are infinite, and second, if invalid starting values have been supplied. Assuming that you haven't supplied starting values, then I suggest doing so, by using the start = option in glm.
Having said that, the only times I have seen this problem is when either the dataset is pathological, or the model is wrong (for example using an inappropriate link function). Since you don't supply a reproducible example, there isn't much more we can say.
I have run a cox regression model below
allcause_cox<-coxph(Surv(allcause_time, allcause)~centgroup, data=fulldata)
This has run fine. However I want to return robust standard error. Therefore I have introduced the
cluster(parity)
term into the model, where parity is another variable in my data set. However this won't run. It returns the error
> allcause_cox<-coxph(Surv(allcause_time, allcause)~centgroup, data=fulldata, cluster(parity))
Error in coxph(Surv(allcause_time, allcause)~centgroup, data=fulldata, :
weights must be finite
Is there a solution to this? I have read about the weight term which can be added but I'm not sure what this does.
cluster is in the wrong place, the command should read
allcause_cox<-coxph(Surv(allcause_time, allcause)~centgroup+cluster(parity), data=fulldata)
I have a set of GLMMs fitted with a binary response variable and a set of continuous variables, and I would like to get confidence intervals for each model. I've been using confint() function, at 95% and with the profile method, and it works without any problems if it is applied to a model with no interactions.
However, when I apply confint() to a model with interactions (continuous*continuous), I've been getting this error:
m1CI <- confint(m1, level=0.95, method="profile")
Error in zeta(shiftpar, start = opt[seqpar1][-w]) :
profiling detected new, lower deviance
The model runs without any problem (although I applied an optimizer because some of the models were having problems with convergence), and here is the final form of one of them:
m1 <- glmer(Use~RSr2*W+RSr3*W+RShw*W+RScon*W+
RSmix*W+(1|Pack/Year),
control=glmerControl(optimizer="bobyqa",
optCtrl=list(maxfun=100000)),
data = data0516RS, family=binomial(link="logit"))
Does anyone know why this is happening, and how can I solve it?
I am using R version 3.4.3 and lme4 1.1-17
The problem was solved by following these instructions:
The error message indicates that during profiling, the optimizer found
a fitted value that was significantly better (as characterized by the
'devtol' parameter) than the supposed minimum-deviance solution returned
in the first place. You can boost the 'devtol' parameter (which is
currently set at a conservative 1e-9 ...) if you want to ignore this --
however, the non-monotonic profiles are also warning you that something
may be wonky with the profile.
From https://stat.ethz.ch/pipermail/r-sig-mixed-models/2014q3/022394.html
I used the confint.merModfrom the lme4 package, and boosted the 'devtol' parameter, first to 1e-8, which didn't work for my models, and then to 1e-7. With this value, it worked
I am trying to verify whether my data set fits exponential or negative binomial, the function works for exponential but I get the following error using "nbinom":
> compare = fitdistr(A, densfun="nbinom")
Error in fitdistr(A, densfun = "nbinom") : unsupported distribution
Note: I know I need more than this to verify its likely distribution. But the issue I am having is more the fact the "nbinom" isn't functioning
It looks like you're conflating the function you've used, MASS::fitdistr(), with fitdistrplus::fitdist().
From the documentation, you can see "negative binomial" is the character string specifying this distribution in the fitdistr function you've used.
In the demo for ROC, there are models that when plotted have a spread, like hiv.svm$predictions which contains 10 estimates of response. Can someone remind me how to calculate N estimates of a model. I'm using RPART and neural network to estimate a single output (true/false). How can I run 10 different sampling for training data to get 10 different model responses to the input. I think the function is called bootstraping, but I don't know how to implement it.
I need to do this outside of caret, cause when I use caret I keep getting the message "Error in tab[1:m, 1:m] : subscript out of bounds". Is there a "simple" bootstrap function?
Obviously the answer is too late, but you could have used caret just by simply renaming the levels of your factor, because caret doesn't work if your binary response is of type logical. For example:
factor(responseWithTrueFalseLevel,
levels=c(TRUE,FALSE),
labels=c("myTrueLevel","myFalseLevel"))