{
  "id": 79891,
  "title": "lag columns in merchants.csv",
  "url": "/competitions/elo-merchant-category-recommendation/discussion/79891",
  "author_name": "",
  "post_date": "2019-02-08T10:15:02.273003800Z",
  "votes": null,
  "comment_count": 2,
  "views": 0,
  "content": "<p>I have question regarding <code>avg_sales_lag_n</code>, <code>avg_purchases_lag_n</code>, <code>active_months_lag_n</code> columns in the <code>merchants.csv</code> file. Data dictionary define these columns as:</p>\n\n<ul>\n<li><code>avg_sales_lag_n</code>: Monthly average of revenue in last <code>n</code> months divided by revenue in last active month</li>\n<li><code>avg_purchases_lag_n</code>: Monthly average of transactions in last <code>n</code> months divided by transactions in last active month</li>\n<li><code>active_months_lag_n</code>: Quantity of active months within last <code>n</code> months</li>\n</ul>\n\n<p>I have 2 questions:</p>\n\n<ol>\n<li>Why are these columns called lag columns? Is it because, this ratio denotes how much you are behind or ahead the <code>n</code> month average? I don't understand how this is lag</li>\n<li>There are a few negative values in the <code>avg_sales_lag_n</code> columns. By looking at the definitions of these columns, I don't understand how they can be negative. Can anyone explain how is this possible? I was thinking may be denominator is negative which here is revenue in last active month making it an expense. Is this possible?</li>\n</ol>",
  "messages": [
    {
      "id": "468112",
      "postDate": "02/08/2019 10:15:02",
      "content": "<p>I have question regarding <code>avg_sales_lag_n</code>, <code>avg_purchases_lag_n</code>, <code>active_months_lag_n</code> columns in the <code>merchants.csv</code> file. Data dictionary define these columns as:</p>\n\n<ul>\n<li><code>avg_sales_lag_n</code>: Monthly average of revenue in last <code>n</code> months divided by revenue in last active month</li>\n<li><code>avg_purchases_lag_n</code>: Monthly average of transactions in last <code>n</code> months divided by transactions in last active month</li>\n<li><code>active_months_lag_n</code>: Quantity of active months within last <code>n</code> months</li>\n</ul>\n\n<p>I have 2 questions:</p>\n\n<ol>\n<li>Why are these columns called lag columns? Is it because, this ratio denotes how much you are behind or ahead the <code>n</code> month average? I don't understand how this is lag</li>\n<li>There are a few negative values in the <code>avg_sales_lag_n</code> columns. By looking at the definitions of these columns, I don't understand how they can be negative. Can anyone explain how is this possible? I was thinking may be denominator is negative which here is revenue in last active month making it an expense. Is this possible?</li>\n</ol>",
      "rawMarkdown": "I have question regarding ```avg_sales_lag_n```, ```avg_purchases_lag_n```, ```active_months_lag_n``` columns in the ```merchants.csv``` file. Data dictionary define these columns as:\n\n- ```avg_sales_lag_n```: Monthly average of revenue in last ```n``` months divided by revenue in last active month\n- ```avg_purchases_lag_n```: Monthly average of transactions in last ```n``` months divided by transactions in last active month\n- ```active_months_lag_n```: Quantity of active months within last ```n``` months\n\nI have 2 questions:\n\n1. Why are these columns called lag columns? Is it because, this ratio denotes how much you are behind or ahead the ```n``` month average? I don't understand how this is lag\n2. There are a few negative values in the ```avg_sales_lag_n``` columns. By looking at the definitions of these columns, I don't understand how they can be negative. Can anyone explain how is this possible? I was thinking may be denominator is negative which here is revenue in last active month making it an expense. Is this possible?",
      "votes": null
    },
    {
      "id": "468120",
      "postDate": "02/08/2019 10:30:23",
      "content": "<p>Hi Shivam,</p>\n\n<p>the columns are called <code>lag</code> because they refer to a past period (of 3/6/12 months).</p>\n\n<p>The values are negative, as pointed out in some other discussions and kernels, because the features have been rescaled (and a log is involved, thus giving the negative value)</p>",
      "rawMarkdown": "Hi Shivam,\n\nthe columns are called `lag` because they refer to a past period (of 3/6/12 months).\n\nThe values are negative, as pointed out in some other discussions and kernels, because the features have been rescaled (and a log is involved, thus giving the negative value)",
      "votes": null
    },
    {
      "id": "468162",
      "postDate": "02/08/2019 11:49:37",
      "content": "<p>Negative values can be explained by the rescaling and log, but values are still high (-80 and positive values to the order of 5/6).</p>\n\n<p>I'll check out the kernels and discussion where this part is discussed. Thanks for the reply.</p>",
      "rawMarkdown": "Negative values can be explained by the rescaling and log, but values are still high (-80 and positive values to the order of 5/6).\n\nI'll check out the kernels and discussion where this part is discussed. Thanks for the reply.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 468120,
      "author_name": "lucabasa",
      "author_url": "",
      "post_date": "02/08/2019 10:30:23",
      "content": "<p>Hi Shivam,</p>\n\n<p>the columns are called <code>lag</code> because they refer to a past period (of 3/6/12 months).</p>\n\n<p>The values are negative, as pointed out in some other discussions and kernels, because the features have been rescaled (and a log is involved, thus giving the negative value)</p>",
      "votes": null,
      "replies": [
        {
          "id": 468162,
          "author_name": "tminima",
          "author_url": "",
          "post_date": "02/08/2019 11:49:37",
          "content": "<p>Negative values can be explained by the rescaling and log, but values are still high (-80 and positive values to the order of 5/6).</p>\n\n<p>I'll check out the kernels and discussion where this part is discussed. Thanks for the reply.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "468112": "I have question regarding ```avg_sales_lag_n```, ```avg_purchases_lag_n```, ```active_months_lag_n``` columns in the ```merchants.csv``` file. Data dictionary define these columns as:\n\n- ```avg_sales_lag_n```: Monthly average of revenue in last ```n``` months divided by revenue in last active month\n- ```avg_purchases_lag_n```: Monthly average of transactions in last ```n``` months divided by transactions in last active month\n- ```active_months_lag_n```: Quantity of active months within last ```n``` months\n\nI have 2 questions:\n\n1. Why are these columns called lag columns? Is it because, this ratio denotes how much you are behind or ahead the ```n``` month average? I don't understand how this is lag\n2. There are a few negative values in the ```avg_sales_lag_n``` columns. By looking at the definitions of these columns, I don't understand how they can be negative. Can anyone explain how is this possible? I was thinking may be denominator is negative which here is revenue in last active month making it an expense. Is this possible?",
    "468120": "Hi Shivam,\n\nthe columns are called `lag` because they refer to a past period (of 3/6/12 months).\n\nThe values are negative, as pointed out in some other discussions and kernels, because the features have been rescaled (and a log is involved, thus giving the negative value)",
    "468162": "Negative values can be explained by the rescaling and log, but values are still high (-80 and positive values to the order of 5/6).\n\nI'll check out the kernels and discussion where this part is discussed. Thanks for the reply."
  },
  "source": "meta"
}