Introduction to Statistics and R Programming
Introduction to the Course and Logistics
- Instructional Team: Amal is the lecturer and tutor (Mason campus/Monday at twelve). James is the main convener at the Nathan campus; he handles course-wide matters and extensions.
- Learning Platform (Canva): Canva serves as the central repository for all resources, including lecture recordings, workshop materials, and assessment details.
- Assessment Structure:
- Workshops: 20% of the total grade. These occur every fortnight (online workshops might appear weekly in structure but represent fortnightly tasks).
- Assignment 1: 12% of the total grade.
- Assignment 2: This is a hurdle assessment; it must be submitted to pass the course.
- Final Exam: 50% of the total grade. A minimum mark of 40% (40 out of 100) is required on the exam to pass the course overall.
- Workshop Preparation: Students are strongly encouraged to complete accessible tasks and review workshop questions before attending. James provides instructional clips on navigating R, which should be viewed beforehand to maximize in-person help.
The Importance and Utility of Statistics
- Definition: Statistics is a formal toolset used to collect, analyze, and interpret data. It allows researchers to organize information based on empirical evidence.
- Data Literacy: This involves the design, narration, and analysis of data. On the current planet, approximately 1.7megabytes of information are produced every single second.
- Interdisciplinary Application: Statistics is used in all fields that require data collection, including science, history, humanities, and the arts. While some fields use qualitative data (interviews/surveys), quantitative analysis is necessary to determine correlation or causation.
- Indirect Use: Even if not performing the math directly, researchers must be able to interpret the results and design choices of others (e.g., why specific variables were selected).
- Research and Development (R&D): Essential for all scientific research. "Science" in this context refers to any research involving data interpretation (education, arts, etc.).
- Risk Management: Statistics facilitates predictions. For example, historical fire data can be used to predict future intensities, which informs government policy and fire risk management.
Principles of Sampling and Population
- The Purpose of Sampling: It is often impossible or impractical to test every member of a population (e.g., testing every single olive in a country). Sampling involves selecting a specific number of items to represent the larger group.
- Population vs. Sample:
- Population: The entire group being studied (e.g., every human on the planet, every car in the world).
- Sample: A subset of the population used for analysis.
- Random Sampling: Critical for accuracy. If samples are clustered (non-random), they may not represent the population. Random generators help ensure every unit has an equal chance of selection.
- Key Statistical Symbols:
- Population Mean (μ): The theoretical mean of the entire population; it is often unknown and assumed to be 0 in specific tests if not stated.
- Sample Mean (xˉ): The observed mean calculated from a collected sample; it is the best estimate of the theoretical truth.
- Population Standard Deviation (σ): The theoretical variability of the population.
- Sample Standard Deviation (S): Measured variability within the collected sample.
- Sample Size: The larger the sample size, the more accurately it represents the population.
- Statistical Inference: The process of using sample data to make estimates or inferences about the parameters of the broader population.
Language and Variables in Statistics
- Variable: A measurement of something that varies (e.g., height, nitrogen levels). Variability indicates how data points differ from the mean.
- Individual / Experimental Unit: The specific thing being measured to obtain variable data (e.g., a person, a tree, a field paddock).
- Random Variables: Variables that depend on chance, usually symbolized by an uppercase letter.
- Error: In statistics, "error" does not mean a mistake; it refers to uncertainty or factors not accounted for, such as human error, statistical error, or experimental error.
- Uncertainty: An estimate of the range of possible values where the actual value likely resides, based on measurement reliability.
- Categorical (Qualitative) Data: Data that falls into groups.
- Nominal: Data with no natural order (e.g., gender).
- Ordinal: Data with a natural order (e.g., shirt sizes: Small, Medium, Large; survey rankings).
- Numeric (Quantitative) Data: Numerical measurements.
- Discrete: Countable values, usually whole numbers (e.g., population counts, number of items).
- Continuous: Measured values that can take any value in a range (e.g., height, temperature, distance).
Research Categories and Hypotheses
- Explanatory Research: Fact-finding investigation often performed without a specific hypothesis.
- Controlled Experimentation:
- Observational Study: Measurements are taken without manipulating the environment. For example, observing sleep patterns relative to stress without interference.
- Experimental Study: The researcher manipulates one variable to observe a response while maintaining a "control" (a group that receives no manipulation).
- Empirical Probability: Predictions based on historical or past data (e.g., climate extremes based on tree rings or ice cores).
- Hypothesis Testing:
- Research Question: A broad inquiry (e.g., "Are Scandinavians taller than Australians?").
- Hypothesis: A specific prediction (e.g., "Scandinavians are taller than Australians").
- Null Hypothesis (H0): The statement that there is no difference or that variables are not related.
- Estimation: Focused on the value of something (e.g., "What is the average height?").
Data Visualization and Interpretation
- Bar Charts: Effective for comparing categorical variables next to each other.
- Pie Charts: Generally considered poor for data visualization because humans have difficulty interpreting fractions/percentages visually; occasionally useful for genetics due to large data sets.
- Histograms: Used to show the frequency distribution of quantitative data.
- Box Plots: Visually represent a "five-number summary," including the mean, standard deviation, quantiles, and maximum values.
- Scatter Plots: Primarily used for numeric variables to show trends and identify line of fit. These are common in regression analysis.
- Correlation vs. Causation:
- Correlation: Indicates two variables are related or affect each other somehow.
- Causation: Indicates one variable directly causes a change in another.
- Note: Most research identifies correlation. Causation is extremely difficult to prove because many factors (e.g., the hydrogen cycle, climate) interact simultaneously.
- Example: A joke example in statistics shows a correlation between the decreasing number of pirates and rising global temperatures; however, there is no causal link.
Software and Technology: Introduction to R
- R vs. Python: R is used in this course because it was specifically designed for statistical analysis and interpretation.
- R Studio Setup:
- Users must download the R language first before installing R Studio. R Studio is the GUI (Graphical User Interface) but needs the language to function.
- Mac users must ensure their OS is updated for compatibility.
- R Studio Online: Available as a backup, but it does not save progress; local installation on a laptop is required for assessments.
- Coding Best Practices:
- Case Sensitivity: R is case-sensitive; an uppercase letter where a lowercase is expected will cause an error.
- Script vs. Console: Always type code in the R script (white page icon with a green cross). Code entered directly into the console will be deleted when the session ends.
- Saving: Use "File > Save As" and keep scripts in a dedicated statistics folder.
- Importing Data:
- For Excel files (.xlsx): Go to "Import Dataset > From Excel."
- For Text/CSV files (.csv): Common for Mac users; go to "Import Dataset > From Text (readr)."
- Libraries: Use the
library() function to load specific tools (e.g., library(readr)). Hit "Run" to execute code lines.
Questions and Discussion
- Attendee: "There's always a certain probability of something happening?"
- Amal: "Yeah, exactly… anything that you are doing data collection for, you are using statistics."
- Attendee (regarding tree rings): Mentioned that tropical trees might not have rings.
- Amal: "Correct… In tropical forests they don't have specific designated seasons… in New Zealand they have a tree ring laboratory… recorded about 15,000 years of the Kauri species."
- Attendee: Provided examples for data types (Shirt size for Ordinal; Population for Discrete).