1/79
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Defining an Object
Stored objects
ls() or objects()
Check the class
class()
What does the class function return
numeric, integer, character, logical
How does R store categorical data
As a factor
How to assign data as a factor
_______
Combine function
c().... ex: >(vec1
How to check the data type
is.numeric() or is.atomic() or is.vector()
Defining vectors
is.character(c()) or is.vector(c())
Average
mean()
Equal to
==
not equal to
!=
less than
<
less than or equal to
greater than
>
Greater than or equal to
>=
Or
|
And
&
Standard Deviation
sd()
Sum function
sum(),The SUM Function adds all the numbers in a range of cells.
summary function
summary(), returns 5 # summary and mean for numerical data
Rounding function
round((variable),# of places)
If else function
(ifelse"variable"
Data structure and type
str()
Number of elements in a vector
length()
reading in the data
"name"
Finding working directory
getwd()
setting working directory
stewed()
what is strings=TRUE
If you want your character data to be read in as a factor (which is what we will almost always want), use strings=T in the read.csv call.
How to make data numeric
as.numeric()
subsetting
use brackets to specify which row or column you want to apply a function to
ex: variable(". "[subsetted variable])
what does na.rm=TRUE mean
Ignores the NAs in the data to give results for some functions
What is a parameter
number used to describe/summerize the population
Statistic
number calculated from a sample (used to estimate the parameter)
Observational Unit
the unit upon which an observation is made (rows of the dataset)
Variable
a characteristic of an individual or item in the population (columns in the dataset)
Quantitative
numbers that have magnitude (have a unit of measure)
Discrete
counted
Continuos
measured
Qualitive (categorical)
Non-numeric values, No magnitude (ex: zip code, area code, social security number)
nominal
variables that have value that can not be ordered (ex: undergraduate majors)
Ordinal
values can be ordered (ex: length of time employed,
Indentifier variable
a unique indetifier assigned to each individual or item in a group (don't have units, special kind of categorical data, not variables to be analyzed)
Time Series
Variable that is measured at regular intervals over time (sequence of data, equally spaced intervals[daily, weekely, monthly, etc...])
Cross sectional data
when a variable is measured on many subjects at the SAME point in time (or same time frame)
Panel Data
Multiple observational units measured over time (multiple time series overtime in a single dataset)
Data Lake
collection of structured, semi-structured, and unstructured data stored in a single location
Used by data engineers, data architects, and data scientists
data warehouse
stores structured data that is ready for data analytics
Used by business professionals that need ready data
Boxplot
displays the 5-number summary as a central box with whiskers that extend to the non-outlying data values
Code: >boxplot(Yvaraible~Xvariable)
Histogram
Displays the distribution of a quantitative variable. The horizontal axis is marked in the units of measurement for the variable. The vertical axis contains the scale of counts or percents. Each bar in the graph represents an equal-width class.
Code: >hist()
Scatterplot
a graphical depiction of the relationship between two variables
Code: > plot()
xlab
The X axis label
ylab
The y axis label
main
title
sub
subtitle
cex.lab
Font size for label annotation
cex.main
font size for title
line graph
Visualization of one of more time series
bar graph
Displaying categorical data ( a single number for each category, can display parts of a whole or sperate values, gaps between bars)
Pie Chart
categorical data, represents part of a whole
Sample mean
Balanncing point
code: >mean()
Sample median
the middle value in a series of measurements or observations, chosen so that there are equal numbers of measurements in the series that are larger than the median and smaller than the median
code: >median()
Skewed left
mean < median
-tail to the left
symmetric
mean = median
skewed right
mean > median
tail to the right
Mode
most frequently occurring score
Range
Distance between highest and lowest scores in a set of data.
code: >range()
IQR
Q3-Q1
code: >IQR()
variance
standard deviation squared
code: >var()
standard deviation
a measure of variability that describes an average distance of every score from the mean
code: sd()
For symmetric data, report the....
Mean and SD
For skewed distributions, report the....
Median and Quartiles
coefficient of variation
(standard deviation/ mean) X 100
code: >cv()
z-score
the number of standard deviations a particular score is from the mean
Z= (obs. - mean)/SD
Chebyshev's Theorem
for any data set, the proportion of observations that lie within k standard deviations from the mean is at least 1-1/k^2, where k is any number greater than 1 (at least)
2 75%
3 88.9%
4 93.8%
5 96%
Empirical Rule (68-95-99.7)
for datasets that are relatively symmetric/bell shaped
1 sd 68% of data
2 sd 95% of data
3 sd 99.7% of data
skewness
A measure of the shape of a data distribution. Data skewed to the left result in negative skewness; a symmetric data distribution results in zero skewness; and data skewed to the right result in positive skewness
Code: >skewness()
Kurtosis
Measure of the fatness of the tails of a probability distribution relative to that of a normal distribution. Indicates likelihood of extreme outcomes.
Excel uses 0 as a basline instead of 3
code: >kurtosis()
Risk to return
CV, sd/mean
higher the # more riskey
Return to risk
1/CV, mean/SD
Lower number more risky