class: center, middle, inverse, title-slide # Variable Types ### Dr. Dogucu --- layout: true <div class="my-header"></div> <div class="my-footer"> Copyright © <a href="https://mdogucu.ics.uci.edu">Dr. Mine Dogucu</a>. <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a></div> --- class: center middle ## Variables <img src="img/data-candy.png" width="100%" /><img src="img/data-candy-tail.png" width="100%" /> --- ## Variables Variables `sugarpercent`, `pricepercent`, and `winpercent` are __numerical variables__. We can do certain analyses on these variables such as finding an average `winpercent` or the maximum or minimum `winpercent`. Note: Not everything represented by numbers is a numeric variable. e.g. Student ID number is not a numeric variable. --- ## Variables Variables such as `competitorname`, `chocolate`, and `fruity` are __categorical variables__. We cannot take averages or find maximum or minimum of these variables. Categorical variables have __levels__. For instance `chocolate` and `fruity` both have two levels as `TRUE` and `FALSE`. --- <img src="img/diagram_small.png" width="377" style="display: block; margin: auto;" /> --- ## Categorical Variables If the levels of the categorical variable has a comparable ordering then it is called an __ordinal variable__. e.g. variable scholarship_status might have three levels as no scholarship, partial scholarship and full scholarship. We can order these levels from less to more or vice versa. If there is no ordering then a categorical variable would be called a __nominal variable__. e.g. state names. --- ## Numeric Variables Consider a variable `n_kids` which represents number of kids somebody has. Then this variable can take values (0, 1, 2, ...). Notice that this variable can take only integer values. This variable is said to be __discrete__ since it does not take on infinitely many numbers that we are not able to count. Numeric variables that can take infinitely many numbers are said to be __continuous__. Consider somebody's height in cm. This is a continuous variable. Even though we might say somebody is 173 cm, in reality the height could be 170.612476314631 cm. So height can take infinitely many values. --- <img src="img/diagram.png" width="731" style="display: block; margin: auto;" />