AnestisTouloumis / multgee

GEE solver for correlated nominal or ordinal multinomial responses using a local odds ratios parameterization.
https://CRAN.R-project.org/package=multgee
9 stars 1 forks source link

"Please insert initial values" using ordLORgee #2

Closed julclu closed 4 years ago

julclu commented 6 years ago

Hi there,

I am using the following code:

nfse.fit = ordLORgee(formula = tumor_cell_evaluation ~ nfse, link = "logit", 
                      id = t_number, data = recgli, LORstr = "category.exch")
dim(recgli)
#383 73

I am looking to simply run this univariate analysis. This code works fine. When I subset my data down using the following code:

recgli_inCEL = recgli[which(recgli$in_CEL == 1),]
dim(recgli_inCEL)
# 158 73 

nfse.fit2 = ordLORgee(formula = tumor_cell_evaluation ~ nfse, link = "logit", 
                      id = t_number, data = recgli_inCEL, LORstr = "category.exch")

These are almost identical datasets, just one is subset from the other; yet when I run the first code, it works fine and the second code it throws this error: "Please insert initial values."

Why does this happen?

I tried to insert initial values using the following code:

coef_init = summary(nfse.fit)$coefficients[,1]
nfse.fit2 = ordLORgee(formula = tumor_cell_evaluation ~ nfse, link = "logit", 
                      id = t_number, data = recgli_inCEL, LORstr = "category.exch", 
                    bstart = coef_init)

And this did not work very well either. Please advise!

Thank you

Julia

AnestisTouloumis commented 6 years ago

Hi Julia,

To insert the values using the bstart argument, you need to create a numerical vector which includes first the values of the category-specific intercepts in ascending order and then the values of the regression coefficients that relate with the explanatory variables in the order that they appear in the formula argument.

A smaller sample size might be one explanation why the algorithm does not converge. However, I cannot say for sure since I cannot view the dataset.

fusion809 commented 1 year ago

Hi @AnestisTouloumis, I've encountered the same issue. But I keep getting the error: bstart and beta differ in length. I would have assumed beta would be of the same length as the the number of coefficients in the regression, which in my case is 24, but when I set bstart to rep(-1, 24) I get this error. I've also tried setting the length of bstart to the number of intercepts in my regression and that also failed with the differing lengths error.

AnestisTouloumis commented 1 year ago

Hi @fusion809, it is difficult to answer this without a reproducible example/code but my best guess is that the number of coeffients in your model is not 24, e.g. this would be the case if you have not accounted for the category specific intercepts or for a factor with more than two levels. If you can share reproducible code that generates this error message I should be able to be more specific.