Skip to content

MethodError: Cannot convert an object of type Nothing to an object of type Int64 #90

@gpetrini

Description

@gpetrini

Hi again,

I am trying to replicate a model in which I have a dynare script to depart from (I can paste it here if it helps). I notice that the lags/leads of some variables causes the error MethodError: Cannot convert an object of type Nothing to an object of type Int64. I tried in different julia version and the error still persists. I manage to replicate the error with only two equations, so I imagine that it became easier to debug:

Code that is not working:

@model Baseline begin
           ## 1 FOC labor demand
           lvar[0] - mcvar[0] + w[0] - y[0] = 0
           ##2 FOC capital utilization
           (1 - alph) * k[-1] = (1 - alph)*lvar[0] + mcvar[0] - pi[0] + tfp[0] + (-1 + alph - edp)*uvar[0] + (-1 + thetta) * a[-1]
       end

However, when I change k[-1] to k[0] and a[-1] to a[0], the error no longer raises. This error message appears for some (not for every) equation that has mixed time leads/lags.

Also, since I am trying to replicate a dynare script, do you have any suggestion on how to define those local-scope variables from dynare? (If I am not wrong, are those expressions starting with #). So far, I simply treated them as parameters defined by other parameters.

Thank you again for your help and sorry for opening another issue.

Best

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions