1. Home
  2. Explore
  3. Statistics
  4. R Statistics and Machine Learning

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

R Statistics and Machine Learning

  • 94Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Why Learn R

Why is the ability to understand, process, extract value from, visualize, and communicate data considered an important skill?

94 questions

  1. 1

    Why is the ability to understand, process, extract value from, visualize, and communicate data considered an important skill?

    Model answer

    Because data are increasingly abundant, and people need to interpret them and use them to gain and communicate useful insights.

    Explanation

    The workshop presents data analysis as an important skill across professional and educational settings.

  2. 2

    How can programming support reproducibility in evidence-based practice and open science?

    Model answer

    A script records the steps used to process and analyze data, allowing the same procedure to be rerun and the results checked.

    Explanation

    Reproducibility depends on being able to repeat the process that produced the results.

  3. 3

    How can a programming language such as R improve on a workflow that uses spreadsheets for preprocessing and separate statistical software for analysis?

    Model answer

    It can bring data preprocessing, analysis, and related procedures together in one script-based workflow.

    Explanation

    Keeping the steps together helps make the process more reproducible and easier to inspect.

  4. 4

    Why can programming be more efficient than menu-based software for repeated or complex analyses?

    Model answer

    A script can automate preprocessing, analyses, and outputs, avoiding the need to repeat many menu clicks for each analysis or subgroup.

    Explanation

    Automation is particularly helpful when methods are complex or must be applied repeatedly.

  5. 5

    How do scripts help researchers understand or review one another's analyses?

    Model answer

    Scripts show the specific steps taken on the data, making it easier to reproduce results and assess another researcher's methods.

    Explanation

    A written procedure can clarify methodological details that may be vague in a paper's description.

  6. 6

    What makes R financially accessible to students compared with licensed statistical software mentioned in the workshop?

    Model answer

    R is free, whereas some licensed software requires students to pay for a license.

    Explanation

    The workshop cites the cost of a student license as a barrier that free R avoids.

  7. 7

    What does it mean that R is open source, and what benefit can this provide?

    Model answer

    Its code can be contributed to by others, supporting community development of the language and its tools.

    Explanation

    Community contributions help expand and update the available resources.

  8. 8

    How can R's user community help someone who encounters a programming problem?

    Model answer

    The user may be able to find online answers from people who have encountered similar problems.

    Explanation

    A large community creates a substantial pool of shared help and solutions.

  9. 9

    How can community-developed R packages benefit researchers working with newer methods?

    Model answer

    Researchers can use packages that implement newer statistical methods or algorithms, including methods not available in some other software.

    Explanation

    Packages let users access work contributed by others without implementing every method themselves.

  10. 10

    What advantages follow from R being a scripting language?

    Model answer

    Scripts support communication of procedures, reproducibility, and automation.

    Explanation

    The same written instructions can document and rerun an analysis.

  11. 11

    What do flexibility and extensibility mean in the context of R?

    Model answer

    R users can customize their work and write functions or algorithms for their own projects.

    Explanation

    The language can be adapted and extended beyond its built-in capabilities.

  12. 12

    Why can R's availability on Mac, Windows, and Linux be useful for collaborative analysis?

    Model answer

    People using different operating systems can run analyses in the same language and environment, helping reduce platform-related systematic errors.

    Explanation

    Cross-platform availability makes it easier to use a common analytical tool.

  13. 13

    Why was R presented as a suitable language for the workshop's statistics and machine-learning applications?

    Model answer

    R was designed specifically for statistical work and offers tools for analyzing data, including machine-learning methods.

    Explanation

    Its statistical focus matched the workshop's intended applications.

  14. 14

    What broad pattern did the workshop describe in the use of tools by data scientists?

    Model answer

    R and Python were commonly used, while comparatively few data scientists used software such as SPSS.

    Explanation

    The workshop used this pattern to illustrate the relevance of learning R or Python for data science.

  15. 15

    What is RStudio, and why is it useful when working with R?

    Model answer

    RStudio is an integrated development environment that brings together tools for writing and running R scripts, including a console and other work windows.

    Explanation

    R itself is a scripting language, and an IDE provides a more convenient interface for working with it.

  16. 16

    What is the difference between the RStudio text editor and the console?

    Model answer

    The text editor is for writing or storing script text, while the console is where R commands are entered and executed.

    Explanation

    Writing a command in the editor does not by itself run it; the console executes commands.

  17. 17

    What information can the RStudio workspace or environment pane show?

    Model answer

    It can show variables and other objects currently available in the global environment.

    Explanation

    The pane helps users inspect objects created or loaded during a session.

  18. 18

    What is the purpose of the Files, Help, and Plots areas in RStudio?

    Model answer

    They provide access to files, help information, and graphical output such as plots.

    Explanation

    These panes make common development tasks and outputs accessible in the IDE.

  19. 19

    How does R respond when a user enters a simple arithmetic expression in the console?

    Model answer

    It evaluates the expression and returns the result, so the console can be used like a calculator.

    Explanation

    R supports ordinary mathematical operations as well as statistical programming.

  20. 20

    What kinds of logical comparisons can R evaluate?

    Model answer

    It can test equality, inequality, and whether values are greater or less than one another; logical operations also include AND, OR, and NOT.

    Explanation

    Comparisons and logical operators allow code to test conditions.

  21. 21

    What does the equality operator == test in R?

    Model answer

    It tests whether the values on its two sides are equal and returns a logical result.

    Explanation

    For example, comparing 50 with 51 using == returns false.

  22. 22

    What does the assignment operator do in R?

    Model answer

    It stores a value or result under a variable name so it can be used later.

    Explanation

    An assignment such as my_height <- 177 creates a named object without necessarily printing a result.

  23. 23

    What does the c() function do when creating an R object?

    Model answer

    It combines values into a vector.

    Explanation

    The workshop uses it to collect several values under one variable name.

  24. 24

    What is a vector in R?

    Model answer

    A vector is a one-dimensional collection of values of the same type.

    Explanation

    The examples include a character vector of names and a numeric vector of scores.

  25. 25

    What is a list in R, and how does it differ from a vector?

    Model answer

    A list can combine objects of different types, whereas a vector holds values of the same type.

    Explanation

    The example list combines a names vector and an IQ-scores vector.

  26. 26

    What is a matrix, and why is it useful in statistical work?

    Model answer

    A matrix is a data structure arranged in rows and columns; many statistical functions, including regression and machine-learning methods, use matrix-based data.

    Explanation

    Its row-and-column structure also lets users locate individual data points.

  27. 27

    What is a data frame in R?

    Model answer

    A data frame is a table-like structure whose columns can hold variables and whose rows represent observations.

    Explanation

    The example data frame places names and IQ scores in separate columns.

  28. 28

    How can a user check the class or type of an R object?

    Model answer

    By passing the object to the class() function.

    Explanation

    The function identifies whether an object is, for example, a character vector, numeric vector, matrix, or data frame.

  29. 29

    Why must users distinguish uppercase and lowercase letters in R object names?

    Model answer

    R is case-sensitive, so names such as X and x refer to different objects.

    Explanation

    Using the wrong capitalization can produce an object-not-found error.

  30. 30

    What are the two broad kinds of R functions described in the workshop?

    Model answer

    Functions supplied by others, often through packages, and user-defined functions written by the programmer.

    Explanation

    Users can both reuse community functions and create functions for their own tasks.

  31. 31

    What are the main parts of a user-defined function?

    Model answer

    A function name, its arguments (inputs), and expressions specifying what to do with those inputs.

    Explanation

    The function structure connects named inputs to operations that produce an action or result.

  32. 32

    Why must text such as Hello World! be enclosed in quotation marks when used as a string in R?

    Model answer

    Quotation marks tell R to treat the text as a character string rather than as the name of a variable.

    Explanation

    Without quotes, R may interpret the text as an object name.

  33. 33

    What is the purpose of the tidyverse package collection in the data workflow described?

    Model answer

    It brings together packages for importing, cleaning, manipulating, transforming, and visualizing data.

    Explanation

    Installing the collection can provide several commonly used data-science tools at once.

  34. 34

    What is the difference between installing an R package and loading it?

    Model answer

    Installing downloads the package to the computer; loading makes an installed package available in the current session.

    Explanation

    The workshop uses install.packages() to install and library() to load a package.

  35. 35

    Which tidyverse packages were associated with importing, manipulating, cleaning, and visualizing data?

    Model answer

    readr was associated with importing, dplyr with data manipulation, tidyr with tidying data, and ggplot2 with visualization.

    Explanation

    The collection includes tools for multiple stages of a data-analysis workflow.

  36. 36

    What stages does the data model describe from raw data to communication?

    Model answer

    Import data, tidy or transform it, visualize it, model or analyze it, consider further analyses as needed, and communicate the results.

    Explanation

    The model emphasizes that analysis is only one part of preparing results for communication.

  37. 37

    Why is data import an important part of an analysis workflow?

    Model answer

    Data must be brought into the working environment before it can be cleaned, transformed, analyzed, or visualized.

    Explanation

    Import is the first step in turning raw data into communicable results.

  38. 38

    What is the purpose of tidying or transforming a dataset before analysis?

    Model answer

    It cleans the data and reshapes or modifies its table structure so it is suitable for the intended analysis.

    Explanation

    Data preparation is a substantive part of handling data, not merely a step before statistical modeling.

  39. 39

    What information does dim() provide for a data table?

    Model answer

    It returns the table's dimensions, such as its number of rows and columns.

    Explanation

    Dimensions give a quick sense of the size and structure of a dataset.

  40. 40

    How do head() and tail() help inspect a dataset?

    Model answer

    head() displays the first rows, and tail() displays the last rows; by default, the examples show six rows.

    Explanation

    These functions provide a quick preview without printing the entire table.

  41. 41

    How can a user find the names of variables in a data frame?

    Model answer

    By applying names() to the data frame.

    Explanation

    The returned names identify the table's variables or columns.

  42. 42

    What information was contained in the Gapminder dataset used in the workshop?

    Model answer

    It included country, year, population, continent, life expectancy, and GDP per capita.

    Explanation

    These variables provided examples for filtering, visualization, and statistical analysis.

  43. 43

    What does NA indicate in R, and what can happen when it is included in a calculation?

    Model answer

    NA indicates missing or unavailable data; a calculation such as the mean may return NA if missing values are not handled.

    Explanation

    Missing observations can prevent a function from producing the intended summary unless the function is instructed to remove them.

  44. 44

    How can the mean() function calculate a mean while ignoring missing values?

    Model answer

    Set its na.rm argument to TRUE.

    Explanation

    The argument's default is FALSE, so missing values are not removed unless requested.

  45. 45

    How does the filter() function support data analysis?

    Model answer

    It selects rows that meet specified conditions, such as a particular year, continent, or population threshold.

    Explanation

    Filtering creates a subset focused on observations relevant to a question.

  46. 46

    How would a researcher use filter() to select observations from a particular year?

    Model answer

    They would filter the dataset using a condition that the year variable equals the target year.

    Explanation

    The workshop illustrates selecting only observations from 2007.

  47. 47

    How would a researcher select only Asian observations from the Gapminder data?

    Model answer

    They would filter for rows where the continent variable equals Asia.

    Explanation

    The condition applies to the continent variable, not the country variable.

  48. 48

    How can a researcher create a subset containing only observations above a population threshold?

    Model answer

    They can use filter() with a condition requiring the population variable to be greater than the chosen threshold.

    Explanation

    The workshop demonstrates this approach for identifying large-population observations.

  49. 49

    Why does the workshop recommend visualizing data before or alongside modeling?

    Model answer

    Visualizations can communicate patterns quickly and reveal insights that may be harder to see in raw numbers or text.

    Explanation

    Visual presentations are often easier for people to process than lengthy reports or complex data tables.

  50. 50

    What is the basic idea behind building a plot with ggplot2?

    Model answer

    Plots are constructed by adding layers, beginning with data and aesthetic mappings and then adding graphical elements.

    Explanation

    Layering allows a figure to be built and customized step by step.

  51. 51

    In a ggplot() aesthetic mapping, what do x and y specify?

    Model answer

    They specify which variables are mapped to the horizontal and vertical axes.

    Explanation

    For example, GDP per capita can be mapped to the x-axis and life expectancy to the y-axis.

  52. 52

    What does geom_point() add to a ggplot2 figure?

    Model answer

    It adds points, producing a scatter plot when two variables are mapped to the axes.

    Explanation

    Each point represents an observation in the supplied data.

  53. 53

    What is the effect of changing the alpha and size settings for plotted points?

    Model answer

    alpha controls transparency, while size controls point size.

    Explanation

    A lower alpha makes points more transparent, and a larger size makes them bigger.

  54. 54

    How can a plot show which continent each observation belongs to?

    Model answer

    Map the continent variable to the color aesthetic.

    Explanation

    The plot then uses colors to distinguish continent categories.

  55. 55

    What kinds of information can a box plot display when comparing life expectancy across continents?

    Model answer

    It can show the distribution of values across groups, including the median, spread, and potential outliers.

    Explanation

    The workshop uses a box plot to compare life-expectancy distributions by continent.

  56. 56

    What does a histogram show about a variable?

    Model answer

    It shows the distribution of values by displaying how many observations fall into value ranges or bins.

    Explanation

    A life-expectancy histogram can reveal which ranges occur most often.

  57. 57

    What kinds of patterns could be observed in a plot of GDP per capita and life expectancy?

    Model answer

    The workshop describes a general pattern in which life expectancy tends to increase as GDP per capita increases, with differences among continents and population sizes.

    Explanation

    A single figure can reveal several relationships and group patterns at once.

  58. 58

    What does the summary() function provide when applied to a dataset?

    Model answer

    It provides summary information for each variable, such as numerical summaries for numeric variables and basic information for character variables.

    Explanation

    It is a convenient first step for describing a dataset's variables.

  59. 59

    How can summaries be calculated separately for groups such as continents?

    Model answer

    Use a grouping or by operation with the continent variable and apply a summary function to each group.

    Explanation

    Grouped summaries describe each category separately rather than treating all observations as one group.

  60. 60

    How can a researcher determine the number of distinct countries represented in the Gapminder data?

    Model answer

    Find the unique country values and count them; the workshop reports 142 distinct countries.

    Explanation

    unique() identifies distinct values, and length() counts the resulting vector.

  61. 61

    What does the $ operator do when used with a data frame in R?

    Model answer

    It selects a named variable, or column, from the data frame.

    Explanation

    For example, selecting country from a data frame provides that column's values.

  62. 62

    What does the cor() function calculate in the example analysis?

    Model answer

    It calculates the correlation between two variables; the reported correlation between life expectancy and GDP per capita was about 0.58.

    Explanation

    Correlation summarizes the association between the two numeric variables.

  63. 63

    How can a researcher compare life expectancy between Europe and Asia using the approach described?

    Model answer

    First subset the data to those two continents, then use a t-test to compare their life-expectancy means.

    Explanation

    Restricting the data to the relevant groups makes the comparison match the research question.

  64. 64

    What does a negative t-statistic indicate in the described Europe–Asia comparison?

    Model answer

    Given the order of groups in that comparison, it indicates that Europe's mean life expectancy is higher than Asia's.

    Explanation

    The sign of a test statistic depends on the order in which group means are compared.

  65. 65

    What is the purpose of a paired-samples t-test in the year comparison described?

    Model answer

    It tests whether measurements from paired observations at two time points, 2002 and 2007, differ in their means.

    Explanation

    The paired = TRUE setting specifies a paired comparison rather than an independent-groups test.

  66. 66

    Why does the year variable need to be converted to a factor for the described year comparison?

    Model answer

    The conversion makes the numeric year values be treated as categories in the analysis.

    Explanation

    A factor represents distinct groups rather than a continuous numeric quantity.

  67. 67

    What is the purpose of the lm() function in the example?

    Model answer

    It fits a linear model, here predicting life expectancy using population, GDP per capita, and year.

    Explanation

    The model estimates relationships between the outcome and its predictors.

  68. 68

    What does summary() of a fitted linear model report?

    Model answer

    It reports information such as residuals, coefficient estimates, test statistics, p-values, and model-fit measures.

    Explanation

    These outputs help describe estimated effects and overall model performance.

  69. 69

    What are residuals in the linear-model output described in the workshop?

    Model answer

    They represent the variation in the outcome that the model does not explain.

    Explanation

    Residuals are the differences between observed values and model predictions.

  70. 70

    How should the workshop's positive predictor relationships in the linear model be interpreted?

    Model answer

    The model indicated higher predicted life expectancy with greater population, higher GDP per capita, and more recent years, according to the fitted coefficients.

    Explanation

    The direction of a predictor's estimated relationship is read from its coefficient.

  71. 71

    What does an adjusted R2R^2R2 of about 0.4392 indicate in the example model?

    Model answer

    The model explains about 44% of the variance in the outcome, after adjustment for the predictors.

    Explanation

    The workshop describes adjusted R2R^2R2 as an effect-size measure of variance explained.

  72. 72

    How can a user extract specific coefficient estimates from a fitted R model?

    Model answer

    They can access the model's coefficients, for example through the model object's coefficients component.

    Explanation

    Extracting components allows a user to retrieve selected results for further use.

  73. 73

    Why should researchers comment and consistently style their R scripts?

    Model answer

    Comments explain what code does, while a consistent style makes scripts easier for others to read and review.

    Explanation

    Style guides can serve as references, though local conventions may differ.

  74. 74

    What is R Markdown, as described in the workshop?

    Model answer

    It is a way to create a document that combines programming with written content and can include results.

    Explanation

    It can make it easier to present analysis outputs in a document.

  75. 75

    How can a script support communication of research results beyond simply reporting the final numbers?

    Model answer

    It documents the data-processing and analysis steps that led to the results, allowing others to inspect or reproduce them.

    Explanation

    Communicating the process helps readers understand how results were obtained.

  76. 76

    How do experimental datasets and big datasets typically differ in the subject-to-variable pattern described?

    Model answer

    Experimental data often have many subjects and relatively few variables, while big data may have comparatively fewer subjects but many variables.

    Explanation

    The contrast concerns the number of observations relative to the number of features.

  77. 77

    Why can feature reduction or selection be important when analyzing big data?

    Model answer

    Big datasets may contain many variables, so reducing or selecting features can help make prediction or analysis manageable.

    Explanation

    The workshop links this need to the high number of features in big-data settings.

  78. 78

    What is machine learning, in the general sense described in the workshop?

    Model answer

    It uses general algorithms that learn patterns from data rather than being programmed with a fixed set of instructions for every specific phenomenon.

    Explanation

    The algorithm's behavior is informed by experience in the form of data.

  79. 79

    How does the amount of relevant information in training data relate to machine-learning performance, according to the workshop?

    Model answer

    More information can allow an algorithm to learn better and improve its performance, though data quality and relevance still matter.

    Explanation

    More data alone does not guarantee better results if the data are unsuitable or biased.

  80. 80

    What is a classification problem in machine learning?

    Model answer

    It assigns an observation to one of a set of categories based on its features.

    Explanation

    The aim is to identify the class to which a particular instance belongs.

  81. 81

    What is a regression problem in machine learning?

    Model answer

    It builds a model that predicts an outcome for new samples from their features.

    Explanation

    The model learns from existing samples and is then applied to new data.

  82. 82

    What is clustering used for?

    Model answer

    It groups observations to explore similarities, differences, and hidden patterns or structures in data.

    Explanation

    Clustering can reveal groupings without using known outcome labels.

  83. 83

    Which of the three machine-learning tasks discussed are supervised learning, and why?

    Model answer

    Classification and regression are supervised because they use input and output data to develop a predictive model.

    Explanation

    The known outputs provide the target information for learning predictions.

  84. 84

    Why is clustering considered unsupervised learning?

    Model answer

    It groups and interprets data using input features without using output labels to make predictions.

    Explanation

    The grouping structure is sought in the inputs rather than learned from known target outcomes.

  85. 85

    How does classification differ from clustering?

    Model answer

    Classification assigns observations to known categories using labeled examples, whereas clustering seeks groups or patterns without relying on output labels.

    Explanation

    The distinction is whether known categories or outcomes guide the learning process.

  86. 86

    What are two broad purposes for using statistics and machine learning identified in the workshop?

    Model answer

    Inference and prediction.

    Explanation

    Both approaches can be used for these purposes, although they may emphasize them differently.

  87. 87

    What is the goal of statistical inference as described in the workshop?

    Model answer

    To build a mathematical model of how data are generated, so researchers can formalize understanding or test hypotheses about a system.

    Explanation

    Inference focuses on understanding the system and evaluating claims about its behavior.

  88. 88

    What is the goal of prediction in machine learning?

    Model answer

    To forecast unobserved outcomes or future behavior from data, such as predicting disease status from gene-expression patterns.

    Explanation

    Prediction focuses on performance for outcomes not yet observed.

  89. 89

    How does the workshop broadly contrast classical statistics with machine learning?

    Model answer

    Classical statistics is often emphasized for modeling and understanding behavior, while machine learning is often emphasized for prediction.

    Explanation

    The workshop notes that the boundary between the fields is not absolute.

  90. 90

    Why should big data and machine learning be viewed as complements rather than replacements for traditional research methods?

    Model answer

    They can provide additional insights and predictive tools, but they do not make traditional data collection and analysis unnecessary.

    Explanation

    Big data can supplement rather than displace established approaches.

  91. 91

    What does the phrase “more data is not necessarily better data” mean in research?

    Model answer

    A larger dataset does not automatically produce more accurate or valid conclusions; researchers must consider the data's quality, features, and how they were collected.

    Explanation

    Quantity alone cannot guarantee that the data are appropriate for the question.

  92. 92

    What happened in the Google Flu Trends example when public awareness changed people's search behavior?

    Model answer

    After media attention, people searched for flu-related information more often, and Google Flu Trends later predicted more flu activity than the CDC data indicated.

    Explanation

    The search behavior used as a proxy changed in response to publicity about the prediction system.

  93. 93

    What research lesson does the Google Flu Trends example illustrate?

    Model answer

    Data features can change when people react to a system or its publicity, so researchers must carefully assess whether their measurements remain valid.

    Explanation

    A model's input data may be affected by the very knowledge or predictions the model makes public.

  94. 94

    How does the workshop recommend using big data to support scientific research?

    Model answer

    Use it to generate novel hypotheses and insights, then conduct experiments to confirm those hypotheses.

    Explanation

    This approach treats big data as a source of ideas whose claims can be tested through further research.

1 of 94
Question 1 of 94

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent