# RATE and rate column in data

**URL:** <https://discourse.pumas.ai/t/rate-and-rate-column-in-data/1027>\
**Category:** Pumas issues\
**Created:** [May 8, 2024, 7:32pm UTC](https://discourse.pumas.ai/t/rate-and-rate-column-in-data/1027 "2024-05-08T19:32:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PVDodeja](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/pvdodeja/32/458_2.png) [@PVDodeja](https://discourse.pumas.ai/u/PVDodeja)\
**Post date:** [May 8, 2024, 7:32pm UTC](https://discourse.pumas.ai/t/rate-and-rate-column-in-data/1027/1 "2024-05-08T19:32:09Z")

</div>

Hello!  
I am not sure if this is a bug but I encountered it nonetheless.  
As I understand from tutorials, a RATE column needs to be added to the dataset when EVID=1, RATE=-2 for fitting a zero order model. When I named my RATE column uppercase during pre-processing (in R) and loaded into Pumas, I faced issues with estimation of tvdur (for a zero-order absorption model).

The same column with no other changes made when named “rate” lowercase and loaded, works fine and does not encounter errors for estimation of tvdur.

I faced the same issue with simultaneous zero and first order absorption, where my tvdur was not being estimated when the “RATE” column was uppercase.

---

<div class="post-metadata">

**Author:** ![vijay](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/vijay/32/96_2.png) [@vijay](https://discourse.pumas.ai/u/vijay)\
**Post date:** [May 10, 2024, 1:04am UTC](https://discourse.pumas.ai/t/rate-and-rate-column-in-data/1027/2 "2024-05-10T01:04:04Z")

</div>

Dear @PVDodeja - the `read_pumas` function automatically maps if the variable name is `rate`, but if the variable is named `RATE`, you need to explicitly map it as

```julia
read_pumas(df, rate = :RATE)

```

you can read the documentation here

```julia
help?> read_pumas
search: read_pumas

  read_pumas(filepath::String; missingstring = ["", ".", "NA"], kwargs...)
  read_pumas(
    df::AbstractDataFrame;
    observations=Symbol[:dv],
    covariates=Symbol[],
    id::Symbol=:id,
    time::Symbol=:time,
    evid::Union{Nothing,Symbol}=nothing,
    amt::Symbol=:amt,
    addl::Symbol=:addl,
    ii::Symbol=:ii,
    cmt::Symbol=:cmt,
    rate::Symbol=:rate,
    ss::Symbol=:ss,
    route::Symbol=:route,
    mdv::Symbol=nothing,
    event_data::Bool=true,
    covariates_direction::Symbol=:left,
    check::Bool=event_data,
    adjust_evid34::Bool=true
  )

  Import NMTRAN-formatted data. You can either pass a CSV file path as a String or a DataFrame as the first and only positional argument.

    • df: DataFrame contaning the data to be converted to a Vector{<:Subject}.

    • observations: dependent variables specified by a vector of column names.

    • covariates: covariates specified by a vector of column names.

    • id: specifies the ID column of the DataFrame.

    • time: specifies the time column of the DataFrame.

    • evid: specifies the event ID column of the DataFrame. See ?Pumas.Event for more details.

    • amt: specifies the dose amount column of the DataFrame. See ?Pumas.Event for more details.

    • addl: specifies the column of the DataFrame that indicated the number of repeated dose events. If not specified then the value is zero.

    • ii: specifies the dose interval column of the DataFrame. See ?Pumas.Event for more details.

    • cmt: specifies the compartment column of the DataFrame. See ?Pumas.Event for more details.

    • rate: specifies the infusion rate column of the DataFrame. See ?Pumas.Event for more details.

    • ss: specifies the steady state column of the DataFrame. See ?Pumas.Event for more details.

    • route: specifies the route of administration column of the DataFrame. See ?Pumas.Event for more details.

    • mdv: specifies the the column of the DataFrame indicating if observations are missing.

    • event_data: toggles assertions applicable to event data. More specifically, checks if the following columns are present in the DataFrame, either as the default
       values or as user-defined values: :id, :time, and :amt. If no :evid column is present, then a warning will be thrown, and :evid is set to 1 when :amt values are
       >0 or not missing, or :evid is set to 0 when :amt values are missing and observations are not missing. Otherwise, read_pumas will throw an error.

    • covariates_direction: specifies direction of covariate interpolation. Either :left (Last Observation Carried Forward, LOCF) (default), or :right (Next
       Observation Carried Backward, NOCB). Notice, that for model with occasion variables it is important to use :left for the correct behavior of the interpolation.

    • check: toggles NMTRAN compliance check of the input data. More specifically, checks if the following columns are present in the DataFrame, either as the default
       values or as user-defined values: :id, :time, :amt, :cmt, :evid, :addl, :ii, :ss, and :route. Additional checks are:
       • all variables in observations are numeric, i.e. Integer or AbstractFloat.
       • :amt column is numeric, i.e. Integer or AbstractFloat.
       • :cmt column is either a positive Integer, an AbstractString, or a Symbol.
       • :amt values must be missing or 0 when evid = 0; or >=0 otherwise.
       • all variables in observation are missing when evid = 1.
       • :ii column must be present if :ss is specified or present.
       • :ii values must be missing or 0 when evid = 0.
       • :ii column must be >0 if :addl values are >0, and vice-versa.
       • :addl column, if present, must be >=0 when evid = 1.
       • :evid values must be !=0 when :amt values are >0, or :addl and :ii values are >0.

    • adjust_evid34: toggles adjustment of time vector for reset events (evid = 3 and evid = 4). If true (the default) then the time of the previous event is added to
       the time on record to ensure that the time vector is monotonically increasing.

```

---

<div class="post-metadata">

**Author:** ![PVDodeja](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/pvdodeja/32/458_2.png) [@PVDodeja](https://discourse.pumas.ai/u/PVDodeja)\
**Post date:** [May 15, 2024, 6:00pm UTC](https://discourse.pumas.ai/t/rate-and-rate-column-in-data/1027/3 "2024-05-15T18:00:26Z")

</div>

Thank you for your response Dr. Ivaturi.  
Oops that makes sense! Sorry for the confusion
