Error in solve.default(as.matrix(fit$hessian))

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Error in solve.default(as.matrix(fit$hessian))

Alvinda Nisma Yusniar
*Dear list,*



*I'm trying to construct a zero-inflated poisson model but I get  greeted
by an error. I haven't had the chance to try my dataset on different OSs or
different R version, but I did mange to try that for the "cod parasite"
data from Zuur et al book (Mixed effect models...) and I get a similar
error (models with different formulas may or may not go through, depending
on R  version and the system). This is the error I get for the cod data.*



M3 <- zeroinfl(Y ~ X1+X2+X3+X4+X5+X6+X7 | ## Predictor for the Poisson process

+                  X1+X2+X3+X4+X5+X6+X7, ## Predictor for the Bernoulli process;

+                dist = 'poisson',

+                data = DB)

Error in solve.default(as.matrix(fit$hessian)) :

  system is computationally singular: reciprocal condition number = 1.12074e-52

In addition: Warning message:

glm.fit: fitted probabilities numerically 0 or 1 occurred



*I get the same error on my data:*



frm <- formula(Y ~ X1+X2+X3+X4+X5+X6+X7| X1+X2+X3+X4+X5+X6+X7)

nb <- zeroinfl(frm, dist="negbin", link="logit", data=DB)

Error in solve.default(as.matrix(fit$hessian)) :

  system is computationally singular: reciprocal condition number = 2.80889e-26

In addition: Warning message:

glm.fit: fitted probabilities numerically 0 or 1 occurred





I would suggest to simplify your model (dropping covariates). I guess

the code has difficulties estimating standard errors, or it may be in a

local optimum. Or contact the owner of the package.



If some of your covariates are factors with many levels, then this may

also cause numerical instabilities. Perhaps you can simplify the binary

part of the model?







* Has anyone any idea how to solve this? It has been suggested that it's
something in my data, but I don't know what to think if the cod parasite
data shows different success/failures on different versions for the same
model.*





*Cheers,*

Alvinda

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Reply | Threaded
Open this post in threaded view
|

Re: Error in solve.default(as.matrix(fit$hessian))

Christopher David Desjardins-2
Alvinda,
Do you have a predictor that has only a 0 or > 0 for the Y and is a factor?
That error message is telling you have perfect discrimination. You will
need to drop that predictor or use a different method.
Chris

On Mon, Dec 9, 2019 at 8:16 PM Alvinda Nisma Yusniar <
[hidden email]> wrote:

> *Dear list,*
>
>
>
> *I'm trying to construct a zero-inflated poisson model but I get  greeted
> by an error. I haven't had the chance to try my dataset on different OSs or
> different R version, but I did mange to try that for the "cod parasite"
> data from Zuur et al book (Mixed effect models...) and I get a similar
> error (models with different formulas may or may not go through, depending
> on R  version and the system). This is the error I get for the cod data.*
>
>
>
> M3 <- zeroinfl(Y ~ X1+X2+X3+X4+X5+X6+X7 | ## Predictor for the Poisson
> process
>
> +                  X1+X2+X3+X4+X5+X6+X7, ## Predictor for the Bernoulli
> process;
>
> +                dist = 'poisson',
>
> +                data = DB)
>
> Error in solve.default(as.matrix(fit$hessian)) :
>
>   system is computationally singular: reciprocal condition number =
> 1.12074e-52
>
> In addition: Warning message:
>
> glm.fit: fitted probabilities numerically 0 or 1 occurred
>
>
>
> *I get the same error on my data:*
>
>
>
> frm <- formula(Y ~ X1+X2+X3+X4+X5+X6+X7| X1+X2+X3+X4+X5+X6+X7)
>
> nb <- zeroinfl(frm, dist="negbin", link="logit", data=DB)
>
> Error in solve.default(as.matrix(fit$hessian)) :
>
>   system is computationally singular: reciprocal condition number =
> 2.80889e-26
>
> In addition: Warning message:
>
> glm.fit: fitted probabilities numerically 0 or 1 occurred
>
>
>
>
>
> I would suggest to simplify your model (dropping covariates). I guess
>
> the code has difficulties estimating standard errors, or it may be in a
>
> local optimum. Or contact the owner of the package.
>
>
>
> If some of your covariates are factors with many levels, then this may
>
> also cause numerical instabilities. Perhaps you can simplify the binary
>
> part of the model?
>
>
>
>
>
>
>
> * Has anyone any idea how to solve this? It has been suggested that it's
> something in my data, but I don't know what to think if the cod parasite
> data shows different success/failures on different versions for the same
> model.*
>
>
>
>
>
> *Cheers,*
>
> Alvinda
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-ecology mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Reply | Threaded
Open this post in threaded view
|

Re: Error in solve.default(as.matrix(fit$hessian))

Alvinda Nisma Yusniar
Thanks for the tip!

Pada tanggal Sel, 10 Des 2019 pukul 23.23 Christopher David Desjardins <
[hidden email]> menulis:

> Alvinda,
> Do you have a predictor that has only a 0 or > 0 for the Y and is a
> factor? That error message is telling you have perfect discrimination. You
> will need to drop that predictor or use a different method.
> Chris
>
> On Mon, Dec 9, 2019 at 8:16 PM Alvinda Nisma Yusniar <
> [hidden email]> wrote:
>
>> *Dear list,*
>>
>>
>>
>> *I'm trying to construct a zero-inflated poisson model but I get  greeted
>> by an error. I haven't had the chance to try my dataset on different OSs
>> or
>> different R version, but I did mange to try that for the "cod parasite"
>> data from Zuur et al book (Mixed effect models...) and I get a similar
>> error (models with different formulas may or may not go through, depending
>> on R  version and the system). This is the error I get for the cod data.*
>>
>>
>>
>> M3 <- zeroinfl(Y ~ X1+X2+X3+X4+X5+X6+X7 | ## Predictor for the Poisson
>> process
>>
>> +                  X1+X2+X3+X4+X5+X6+X7, ## Predictor for the Bernoulli
>> process;
>>
>> +                dist = 'poisson',
>>
>> +                data = DB)
>>
>> Error in solve.default(as.matrix(fit$hessian)) :
>>
>>   system is computationally singular: reciprocal condition number =
>> 1.12074e-52
>>
>> In addition: Warning message:
>>
>> glm.fit: fitted probabilities numerically 0 or 1 occurred
>>
>>
>>
>> *I get the same error on my data:*
>>
>>
>>
>> frm <- formula(Y ~ X1+X2+X3+X4+X5+X6+X7| X1+X2+X3+X4+X5+X6+X7)
>>
>> nb <- zeroinfl(frm, dist="negbin", link="logit", data=DB)
>>
>> Error in solve.default(as.matrix(fit$hessian)) :
>>
>>   system is computationally singular: reciprocal condition number =
>> 2.80889e-26
>>
>> In addition: Warning message:
>>
>> glm.fit: fitted probabilities numerically 0 or 1 occurred
>>
>>
>>
>>
>>
>> I would suggest to simplify your model (dropping covariates). I guess
>>
>> the code has difficulties estimating standard errors, or it may be in a
>>
>> local optimum. Or contact the owner of the package.
>>
>>
>>
>> If some of your covariates are factors with many levels, then this may
>>
>> also cause numerical instabilities. Perhaps you can simplify the binary
>>
>> part of the model?
>>
>>
>>
>>
>>
>>
>>
>> * Has anyone any idea how to solve this? It has been suggested that it's
>> something in my data, but I don't know what to think if the cod parasite
>> data shows different success/failures on different versions for the same
>> model.*
>>
>>
>>
>>
>>
>> *Cheers,*
>>
>> Alvinda
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-ecology mailing list
>> [hidden email]
>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>>
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology