{
  "source_file": "0930",
  "source_platform": "Ghost",
  "author": "Avi Chawla / Daily Dose of Data Science",
  "title_listed": "11 Types Of Variables In A Dataset",
  "keywords": "",
  "domain": "数据处理",
  "content_type": "深度技术解析",
  "is_paid_flag": "否",
  "url": "https://www.dailydoseofds.com/p/11-types-of-variables-in-a-dataset/",
  "publish_date": "2026-05-06",
  "corpus_stage": "",
  "notes": "",
  "id": "ff06c6b860d5",
  "collected_at": "2026-10-02T13:48:44",
  "title": "11 Types of Variables in a Dataset",
  "body_markdown": "Aug 1, 2024\n11 Types of Variables in a Dataset\nBeyond features, targets, etc.\nAvi Chawla\n👉\nIn any tabular dataset, we typically categorize the columns as either a feature or a target.\nHowever, there are so many variables that one may find/define in their dataset, which I want to discuss today.\nThese are depicted in the animation below:\nLet’s begin!\n#1-2) Independent and dependent variables\nThese are the most common and fundamental to ML.\nIndependent variables are the features that are used as input to predict the outcome. They are also referred to as\npredictors/features/explanatory variables.\nThe dependent variable is the outcome that is being predicted. It is also called the target, response, or output variable.\n#3-4) Confounding and correlated variables\nConfounding variables are typically found in a cause-and-effect study (causal inference).\nThese variables are not of primary interest in the cause-and-effect equation but can potentially lead to spurious associations.\nTo exemplify, say we want to measure the effect of ice cream sales on the sales of air conditioners.\nAs you may have guessed, these two measurements are highly correlated.\nHowever, there’s a confounding variable —\ntemperature\n, which influences both ice cream sales and the sales of air conditioners.\nTo study the true casual impact, it is essential to consider the confounder (temperature). Otherwise, the study will produce misleading results.\nIn fact, it is due to the confounding variables that we hear the statement: “Correlation does not imply causation.”\nIn the above example:\nThere is a high correlation between ice cream sales and sales of air conditioners.\nBut the sales of air conditioners (effect) are\nNOT\ncaused by ice cream sales.\nAlso, in this case, the air conditioner and ice cream sales are\ncorrelated variables\n.\nMore formally, a change in one variable is associated with a change in another.\n#5) Control variables\nIn the above example, to measure the true effect of ice cream sales on air conditioner sales, we must ensure that the temperature remains unchanged throughout the study.\nOnce controlled, temperature becomes a\ncontrol variable\n.\nMore formally, these are variables that are not the primary focus of the study but are crucial to account for to ensure that the effect we intend to measure is not biased or confounded by other factors.\n#6) Latent variables\nA variable that is not directly observed but is inferred from other observed variables.\nFor instance, we use clustering algorithms because the true labels do not exist, and we want to infer them somehow.\nThe true label is a latent variable in this case.\nAnother common example of a latent variable is “intelligence.”\nIntelligence itself cannot be directly measured; it is a latent variable.\nHowever, we can infer intelligence through various observable indicators such as test scores, problem-solving abilities, and memory retention.\nWe also learned about Latent variables when we studied\nGaussian mixture models\nif you remember.\n#7) Interaction variables\nAs the name suggests, these variables represent the interaction effect between two or more variables, and are often used in regression analysis.\nHere’s an instance I remember using them in.\nIn a project, I studied the impact of population density and income levels on spending behavior.\nI created three groups for population density — HIGH, MEDIUM, and LOW (one-hot encoded).\nLikewise, I created three groups for income levels — HIGH, MEDIUM, and LOW (one-hot encoded).\nTo do regression analysis, I created interaction variables by cross-multiplying both one-hot columns.\nThis produced 9 interaction variables:\nPopulation-High and Income-High\nPopulation-High and Income-Med\nPopulation-High and Income-Low\nPopulation-Med and Income-High\nand so on…\nConducting the regression analysis on interaction variables revealed more useful insights than what I observed without them.\nTo summarize, the core idea is to study two or more variables together rather than independently.\n#8-9)\nStationary and Non-Stationary variables:\nThe concept of stationarity often appears in time-series analysis.\nStationary variables are those whose statistical properties (mean, variance) DO NOT change over time.\nOn the flip side, if a variable’s statistical properties change over time, they are called non-stationary variables.\nPreserving stationarity in statistical learning is critical because these models are fundamentally reliant on the assumption that samples are identically distributed.\nBut if the probability distribution of variables is evolving over time, (non-stationary), the above assumption gets violated.\nThat is why, typically, using direct values of the non-stationary feature (like the absolute value of the stock price) is not recommended.\nInstead, I have always found it better to define features in terms of relative changes:\n$$ \\frac{\\delta P}{P} \\rightarrow \\text{relative change in stock price} $$\n#10)\nLagged variables\nTalking of time series, lagged variables are pretty commonly used in feature engineering and data analytics.\nAs the name suggests, a lagged variable represents previous time points’ values of a given variable, essentially shifting the data series by a specified number of periods/rows.\nFor instance, when predicting next month’s sales figures, we might include the sales figures from the previous month as a lagged variable.\nLagged features may include:\n7-day lag on website traffic to predict current website traffic.\n30-day lag on stock prices to predict the next month’s closing prices.\nAnd so on…\n#11)\nLeaky variables\nYet again, as the name suggests, these variables (unintentionally) provide information about the target variable that would not be available at the time of prediction.\nThis leads to overly optimistic model performance during training but fails to generalize to new data.\nI recently talked about leaky variable(s) in this newsletter through random splitting.\nTo reiterate, consider a dataset containing medical imaging data.\nEach sample consists of\nmultiple images\n(e.g., different views of the same patient’s body part), and the model is intended to detect the severity of a disease.\nIn this case, randomly splitting the images into train and test sets will result in data leakage.\nThis is because images of the same patient will end up in both the training and test sets, allowing the model to “see” information from the same patient during training and testing.\nHere’s a paper which committed this mistake (and later corrected it):\nTo avoid this, a patient must only belong to the test or train/val set, not both.\nThis is called group splitting:\nCreating forward-lag features is another way leaky variables get created unintentionally at times:\nThat’s it.\nFrom the above discussion, it is pretty clear that there is a whole world of variables beyond features, targets, categorical and numerical variables, etc.\nOf course, there are a few more types of variables that I haven’t covered here, as I intend to cover them in another issue.\nBut till then, can you tell me which ones I have missed?\nThanks for reading!\nPublished on Aug 1, 2024\nComments\nShare\nCopy link\nShare to X\nShare to Facebook\nShare to Linkedin\nCopied\nPrevious\nModel Calibration (Part 1)\nNext\nFederated Learning: A Critical Step Towards Privacy-Preserving ML",
  "metadata": {
    "title": "11 Types of Variables in a Dataset",
    "description": "Beyond features, targets, etc.",
    "keywords": null,
    "author": null,
    "og:site_name": "Daily Dose of Data Science",
    "og:type": "article",
    "og:title": "11 Types of Variables in a Dataset",
    "og:description": "Beyond features, targets, etc.",
    "og:url": "https://www.dailydoseofds.com/p/11-types-of-variables-in-a-dataset/",
    "og:image": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/size/w1200/2025/04/variables-in-ML.gif",
    "og:image:width": "1200",
    "og:image:height": "1068",
    "twitter:card": "summary_large_image",
    "twitter:title": "11 Types of Variables in a Dataset",
    "twitter:description": "Beyond features, targets, etc.",
    "twitter:url": "https://www.dailydoseofds.com/p/11-types-of-variables-in-a-dataset/",
    "twitter:image": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/size/w1200/2025/04/variables-in-ML.gif",
    "twitter:label1": "Written by",
    "twitter:data1": "Avi Chawla",
    "twitter:label2": "Filed under",
    "twitter:site": "@_avichawla",
    "article:published_time": "2024-08-01T09:48:00.000Z",
    "article:modified_time": "2026-05-06T11:23:37.000Z"
  },
  "paywall": {
    "listed_paid": false,
    "detected": false,
    "marker": "",
    "public_only": false,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 200,
    "error": ""
  },
  "code_blocks": [],
  "images": [
    {
      "status": "ok",
      "url": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/size/w400/2026/03/avi-google.jpg",
      "bytes": 11344,
      "reused": true,
      "local_path": "attachments/ff06c6b860d5/images/000.jpg",
      "src": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/size/w400/2026/03/avi-google.jpg",
      "alt": "Avi Chawla",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f74dcd89e-96e0-4a1a-864e-bf4a2abc2539_1204x1072-1.gif",
      "bytes": 954311,
      "reused": true,
      "local_path": "attachments/ff06c6b860d5/images/001.gif",
      "src": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f74dcd89e-96e0-4a1a-864e-bf4a2abc2539_1204x1072-1.gif",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2fe7c41cfb-bf18-48d2-b3d2-7dbf64cda703_590x230-1.png",
      "bytes": 17055,
      "reused": true,
      "local_path": "attachments/ff06c6b860d5/images/004.png",
      "src": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2fe7c41cfb-bf18-48d2-b3d2-7dbf64cda703_590x230-1.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f22cb8f8c-9061-48fe-9282-7b8cb802cee8_249x231-1.png",
      "bytes": 4215,
      "reused": true,
      "local_path": "attachments/ff06c6b860d5/images/005.png",
      "src": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f22cb8f8c-9061-48fe-9282-7b8cb802cee8_249x231-1.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2fdeb78665-3dc0-4ce0-8c70-20197bb20759_648x254-1.png",
      "bytes": 13035,
      "reused": true,
      "local_path": "attachments/ff06c6b860d5/images/006.png",
      "src": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2fdeb78665-3dc0-4ce0-8c70-20197bb20759_648x254-1.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f3b0b9497-6279-4c14-a340-e950d7a9dfd6_757x260-1.png",
      "bytes": 31775,
      "reused": true,
      "local_path": "attachments/ff06c6b860d5/images/008.png",
      "src": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f3b0b9497-6279-4c14-a340-e950d7a9dfd6_757x260-1.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f8936ca07-fa58-4d16-8225-6e92faac6446_757x240-1.png",
      "bytes": 28875,
      "reused": true,
      "local_path": "attachments/ff06c6b860d5/images/010.png",
      "src": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f8936ca07-fa58-4d16-8225-6e92faac6446_757x240-1.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f866092b2-95f3-4ada-b034-e574d24b99b7_580x230-1.png",
      "bytes": 18507,
      "reused": true,
      "local_path": "attachments/ff06c6b860d5/images/012.png",
      "src": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f866092b2-95f3-4ada-b034-e574d24b99b7_580x230-1.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2fc8a4260c-0a97-48b4-aab1-c83eb84b35f3_639x240-1.png",
      "bytes": 10917,
      "reused": true,
      "local_path": "attachments/ff06c6b860d5/images/013.png",
      "src": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2fc8a4260c-0a97-48b4-aab1-c83eb84b35f3_639x240-1.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f0197e3bc-30f1-4883-a267-0fbb3529fd10_720x277-1.png",
      "bytes": 14096,
      "reused": true,
      "local_path": "attachments/ff06c6b860d5/images/015.png",
      "src": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f0197e3bc-30f1-4883-a267-0fbb3529fd10_720x277-1.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f121deea9-e8bc-439c-83e6-f73ee95bbbcc_800x274-1.png",
      "bytes": 23269,
      "reused": true,
      "local_path": "attachments/ff06c6b860d5/images/017.png",
      "src": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f121deea9-e8bc-439c-83e6-f73ee95bbbcc_800x274-1.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f58c97651-a6a0-41d2-b65e-0b89270c3dcb_528x320-1.png",
      "bytes": 20403,
      "reused": true,
      "local_path": "attachments/ff06c6b860d5/images/019.png",
      "src": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f58c97651-a6a0-41d2-b65e-0b89270c3dcb_528x320-1.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f1b48b60e-53e6-43cc-bc1d-93441ed46721_481x271-1.png",
      "bytes": 21622,
      "reused": true,
      "local_path": "attachments/ff06c6b860d5/images/020.png",
      "src": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f1b48b60e-53e6-43cc-bc1d-93441ed46721_481x271-1.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f6498f95a-0569-47eb-9c21-32012227988e_1004x646-jpeg-1.jpg",
      "bytes": 106607,
      "reused": true,
      "local_path": "attachments/ff06c6b860d5/images/021.jpg",
      "src": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f6498f95a-0569-47eb-9c21-32012227988e_1004x646-jpeg-1.jpg",
      "alt": "Image",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f2d73b8ff-d3da-42da-a8ce-385cc03270e0_2758x960-png-1.jpg",
      "bytes": 79867,
      "reused": true,
      "local_path": "attachments/ff06c6b860d5/images/024.jpg",
      "src": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f2d73b8ff-d3da-42da-a8ce-385cc03270e0_2758x960-png-1.jpg",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f72a6fb12-dae1-43d3-b43b-511b7de7cd9d_800x274-1.png",
      "bytes": 23012,
      "reused": true,
      "local_path": "attachments/ff06c6b860d5/images/027.png",
      "src": "https://storage.ghost.io/c/3f/df/3fdf6ed2-17ac-4b12-a693-8078bd13e748/content/images/2026/01/https-3a-2f-2fsubstack-post-media-s3-amazonaws-com-2fpublic-2fimages-2f72a6fb12-dae1-43d3-b43b-511b7de7cd9d_800x274-1.png",
      "alt": "",
      "downloaded": true
    }
  ],
  "audio": [],
  "videos": [],
  "links": [
    {
      "href": "https://www.dailydoseofds.com/gaussian-mixture-models-gmm/",
      "label": "Gaussian mixture models",
      "type": "a"
    },
    {
      "href": "https://x.com/intent/tweet?url=https%3A%2F%2Fwww.dailydoseofds.com%2Fp%2F11-types-of-variables-in-a-dataset%2F&text=11%20Types%20of%20Variables%20in%20a%20Dataset",
      "label": "Share to X",
      "type": "a"
    },
    {
      "href": "https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fwww.dailydoseofds.com%2Fp%2F11-types-of-variables-in-a-dataset%2F",
      "label": "Share to Facebook",
      "type": "a"
    },
    {
      "href": "https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fwww.dailydoseofds.com%2Fp%2F11-types-of-variables-in-a-dataset%2F",
      "label": "Share to Linkedin",
      "type": "a"
    },
    {
      "href": "https://www.dailydoseofds.com/a-crash-course-of-model-calibration-classification-models/",
      "label": "Previous Model Calibration (Part 1)",
      "type": "a"
    },
    {
      "href": "https://www.dailydoseofds.com/federated-learning-a-critical-step-towards-privacy-preserving-machine-learning/",
      "label": "Next Federated Learning: A Critical Step Towards Privacy-Preserving ML",
      "type": "a"
    }
  ],
  "repair_version": 2,
  "repaired_at": "2026-10-14T10:48:02Z",
  "source_url": "https://www.dailydoseofds.com/p/11-types-of-variables-in-a-dataset/",
  "papers": [],
  "actual_video_files": [],
  "body_chars": 7292,
  "expected_body_images": 16,
  "discovery_status": "ok",
  "delivery_status": "ok",
  "missing_reason": "",
  "raw_html": "attachments/ff06c6b860d5/pages/source.html",
  "local_html": "attachments/ff06c6b860d5/pages/article.html",
  "body_base_path": "attachments/ff06c6b860d5/pages/",
  "body_markdown_path": "attachments/ff06c6b860d5/pages/article.md"
}