.. _variable_types:
        
Variable Types
###################

:numref:`table_variable_types` shows the different type of script variables that are available in the :term:`verbatim` sections of |popy| scripts:-

.. _table_variable_types:

.. list-table:: |popy| Variable Types
    :header-rows: 1
    
    * - Type
      - Description
      - Defined
      - Used
      
    * - |cx| (fit script)
      - |covariates| (fit)
      - |data_file|/|preprocess|
      - main sections
      
    * - |cx| (gen script)
      - |covariates| (gen)
      - |effects|
      - main sections
    
    * - |cx| 
      - |obss| 
      - |predictions| (fit)
      - |predictions| (gen)
      
    * - |fx|
      - |fes|
      - |effects|
      - |model_params|
      
    * - |rx|
      - |res|
      - |effects|
      - |model_params|
     
    * - |mx|
      - Model parameters
      - |model_params|
      - main sections
      
    * - |wx|
      - Workspace Variables
      - |model_params|
      - |model_params|
      
    * - |xnewind|
      - First row for individual
      - |na|
      - |model_params|

    * - |dx|
      - Derivatives |wrt| time
      - |derivatives|
      - |na|
            
    * - |sx|
      - States
      - |derivatives|/|states|
      - |derivatives|/|predictions|
      
    * - |xtime|
      - Continuous time 
      - |na|
      - |derivatives|
      
    * - |px|
      - Predictions
      - |predictions|
      - |predictions|
    
      
In :numref:`table_variable_types`, the 'Defined' column shows where a variable of particular type is first declared, typically on the |lhs| of an '=' or '~' operator. The 'Used' column shows where a variable may be used, typically on the |rhs| of an '=' or '~' operator.

Note the entry 'main sections' in table :numref:`table_variable_types` above means the following sections - |model_params|/|states|/|derivatives|/|predictions|.

..  comment

    It might be a good idea to make a section for each variable type and link from the table?
    probably not 100% required at mo
    

