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

  • 84Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: R and Research

Why does using a programming script support reproducible research?

84 questions

  1. 1

    Why does using a programming script support reproducible research?

    1. A

      It guarantees that every dataset will produce the same result, regardless of its contents.

    2. B

      It automatically corrects errors in the data before any analysis begins.

    3. C

      It records the steps used to process data and produce results, so they can be run again.

    4. D

      It replaces the need to document the methods used in a research project.

    Correct answer
    C

    It records the steps used to process data and produce results, so they can be run again.

    Explanation

    A script makes data-processing and analysis steps explicit, allowing the workflow to be rerun and inspected.

  2. 2

    What is a key advantage of automating an analysis with code rather than repeating menu selections?

    1. A

      Code makes it unnecessary to check whether the input data are appropriate.

    2. B

      Code ensures that complex statistical methods no longer require decisions by the researcher.

    3. C

      Code can rerun a sequence of preprocessing, analysis, and graphing steps without repeating each click.

    4. D

      Code limits analyses to methods that are available in a software menu.

    Correct answer
    C

    Code can rerun a sequence of preprocessing, analysis, and graphing steps without repeating each click.

    Explanation

    A programmed workflow can automate repeated operations, such as running the same analysis for different data subsets.

  3. 3

    How can scripts improve communication about an analysis?

    1. A

      They expose the operations performed, making it easier for others to inspect or rerun them.

    2. B

      They convert every analytical decision into a universally accepted interpretation.

    3. C

      They remove the need to share data or explain the research question.

    4. D

      They ensure that readers will agree with the conclusions.

    Correct answer
    A

    They expose the operations performed, making it easier for others to inspect or rerun them.

    Explanation

    A script provides a record of what was done to the data and how results were produced, which can help others review the method.

  4. 4

    What does it mean that R is open source?

    1. A

      R can only be used when a user has an internet connection.

    2. B

      People can contribute to the development of R and its associated tools.

    3. C

      R makes all analyses public as soon as they are run.

    4. D

      Every package for R is automatically installed with the language.

    Correct answer
    B

    People can contribute to the development of R and its associated tools.

    Explanation

    The workshop describes open source as allowing people to contribute to R.

  5. 5

    Why might a researcher choose R instead of a costly licensed statistics program?

    1. A

      R is free to use, which avoids the expense of purchasing a student license.

    2. B

      R is available only to researchers at academic institutions.

    3. C

      R guarantees that analyses will be statistically significant.

    4. D

      R requires no programming and only uses graphical menus.

    Correct answer
    A

    R is free to use, which avoids the expense of purchasing a student license.

    Explanation

    The workshop contrasts R's free availability with the cost of licenses for some statistical software.

  6. 6

    How can R's large user community benefit someone learning the language?

    1. A

      The community ensures that every online answer is correct for every situation.

    2. B

      Users can often find online discussions and solutions to problems others have encountered.

    3. C

      The community automatically runs analyses on a learner's computer.

    4. D

      Users no longer need to learn how packages or functions work.

    Correct answer
    B

    Users can often find online discussions and solutions to problems others have encountered.

    Explanation

    A large community can provide support and share packages, methods, and solutions to common problems.

  7. 7

    What does R's extensibility allow a user to do?

    1. A

      Avoid specifying what an analysis should do.

    2. B

      Convert every analysis into a graphical menu automatically.

    3. C

      Run R scripts only on the computer where they were written.

    4. D

      Add functions or implement algorithms for a particular project.

    Correct answer
    D

    Add functions or implement algorithms for a particular project.

    Explanation

    R can be extended with user-written functions and algorithms, as well as packages contributed by others.

  8. 8

    Why can running R on Mac, Windows, and Linux support collaborative analysis?

    1. A

      Different operating systems eliminate the need to share scripts.

    2. B

      R scripts require all collaborators to use the same computer.

    3. C

      Researchers using different operating systems can use the same language to run analyses.

    4. D

      The operating systems automatically produce identical research conclusions.

    Correct answer
    C

    Researchers using different operating systems can use the same language to run analyses.

    Explanation

    R is available on multiple operating systems, allowing researchers on those platforms to work with the same programming language.

  9. 9

    Why did the workshop presenter consider R suitable for a statistics-focused workshop?

    1. A

      R is the only programming language capable of processing data.

    2. B

      R was designed specifically for statistical purposes.

    3. C

      R can perform statistical analysis only through a graphical interface.

    4. D

      R does not allow users to write or customize functions.

    Correct answer
    B

    R was designed specifically for statistical purposes.

    Explanation

    The presenter identified R as a language specifically written for statistics, making it suitable for the workshop's analysis needs.

  10. 10

    What is the main role of RStudio in the workshop's setup?

    1. A

      It is a data package that must be loaded before every R calculation.

    2. B

      It provides an integrated development environment for working with R scripts and commands.

    3. C

      It replaces R with a different statistical programming language.

    4. D

      It automatically selects the correct statistical model for any dataset.

    Correct answer
    B

    It provides an integrated development environment for working with R scripts and commands.

    Explanation

    RStudio is an integrated development environment that brings tools such as a script editor, console, workspace, and output panes together.

  11. 11

    Which description best distinguishes RStudio's text editor from its console?

    1. A

      The editor runs commands automatically, while the console is only for writing comments.

    2. B

      The editor stores variables, while the console displays installed packages only.

    3. C

      The editor displays plots, while the console edits the operating system's files.

    4. D

      The editor is for writing script text, while the console is for entering R commands.

    Correct answer
    D

    The editor is for writing script text, while the console is for entering R commands.

    Explanation

    The text editor is used to write scripts, whereas the console accepts commands in the R language.

  12. 12

    What does the R expression 14 + 3 return when entered in the console?

    1. A

      A logical value indicating whether 14 equals 3.

    2. B

      The numeric result 17.

    3. C

      A new variable named 17.

    4. D

      A character string containing "14 + 3".

    Correct answer
    B

    The numeric result 17.

    Explanation

    R can act as a calculator; adding 14 and 3 returns 17.

  13. 13

    What is the result of the R expression 3 ^ 3?

    1. A

      9

    2. B

      81

    3. C

      6

    4. D

      27

    Correct answer
    D

    27

    Explanation

    In R, the caret performs exponentiation, so 33=273^3 = 2733=27.

  14. 14

    What kind of result does an equality test such as 50 == 50 + 1 produce?

    1. A

      A vector containing the two numbers being compared.

    2. B

      A logical value indicating whether the two sides are equal.

    3. C

      A numeric value equal to the sum of the two sides.

    4. D

      A character string containing both sides of the comparison.

    Correct answer
    B

    A logical value indicating whether the two sides are equal.

    Explanation

    The equality operator compares the expressions on its two sides and returns a logical result, here FALSE.

  15. 15

    What happens when a value is assigned to a variable using R's assignment operator?

    1. A

      The value is stored under the variable name for later use.

    2. B

      The value is removed from the current R session.

    3. C

      The value is always printed as the only output of the assignment.

    4. D

      The variable name is converted into a function automatically.

    Correct answer
    A

    The value is stored under the variable name for later use.

    Explanation

    Assignment stores information in a variable; the assignment itself does not necessarily print the value in the console.

  16. 16

    What does c() do when used to create an R variable such as c(177, 156, 189, 200)?

    1. A

      It arranges the values into a data frame with named columns.

    2. B

      It combines the supplied values into a vector.

    3. C

      It converts each supplied value into a separate function.

    4. D

      It removes any repeated values from the input.

    Correct answer
    B

    It combines the supplied values into a vector.

    Explanation

    The c() function combines values into a vector.

  17. 17

    Which description best defines a vector as presented in the workshop?

    1. A

      A table that must contain both rows and columns.

    2. B

      A single variable containing values of the same data type.

    3. C

      A variable that can contain only one value.

    4. D

      A collection of functions with different input arguments.

    Correct answer
    B

    A single variable containing values of the same data type.

    Explanation

    A vector stores multiple values of the same type in one variable.

  18. 18

    What is the main difference between a list and a vector in the examples?

    1. A

      A list must be rectangular, while a vector must have named rows.

    2. B

      A list stores functions only, while a vector stores data only.

    3. C

      A list can contain only numbers, while a vector can contain only text.

    4. D

      A list can combine vectors of different types, while a vector holds values of one type.

    Correct answer
    D

    A list can combine vectors of different types, while a vector holds values of one type.

    Explanation

    The example combines a character vector of names and a numeric vector of IQ scores into a list.

  19. 19

    Why are matrices important in many statistical applications of R?

    1. A

      They automatically remove missing values from every dataset.

    2. B

      They convert all data into graphical output.

    3. C

      They are the only R data structure that can contain numeric values.

    4. D

      They provide row and column structure for locating data points, and many statistical functions use them.

    Correct answer
    D

    They provide row and column structure for locating data points, and many statistical functions use them.

    Explanation

    A matrix has row and column attributes and is used by many statistical functions, including regression-related methods.

  20. 20

    What does a data frame represent in the workshop's examples?

    1. A

      A function that calculates summary statistics for one variable.

    2. B

      A single string containing all observations in sequence.

    3. C

      A matrix that cannot contain named variables.

    4. D

      A table in which variables appear as columns and observations as rows.

    Correct answer
    D

    A table in which variables appear as columns and observations as rows.

    Explanation

    The data frame example displays names and IQ scores as columns and people as rows.

  21. 21

    Why might class(names) return "character" for a vector of names?

    1. A

      The values in the vector are all logical tests.

    2. B

      The values in the vector are text strings.

    3. C

      The vector has been converted into a matrix.

    4. D

      The vector contains only missing values.

    Correct answer
    B

    The values in the vector are text strings.

    Explanation

    The names Peter, John, Mary, and Kate are strings, so their vector has character class.

  22. 22

    What is the effect of using a lowercase x when the defined object is named uppercase X?

    1. A

      R automatically changes x to X because variable names are case-insensitive.

    2. B

      R interprets x as a request to display the matrix dimensions.

    3. C

      R combines the two names into a single variable.

    4. D

      R treats x and X as different names, so it may report that x is not found.

    Correct answer
    D

    R treats x and X as different names, so it may report that x is not found.

    Explanation

    R is case-sensitive, so uppercase X and lowercase x refer to different object names.

  23. 23

    In an R function, what is an argument?

    1. A

      The final result printed by the function.

    2. B

      An input value or variable that the function can use.

    3. C

      A comment describing the function's purpose.

    4. D

      A package that must be installed for every function.

    Correct answer
    B

    An input value or variable that the function can use.

    Explanation

    An argument supplies input data to a function, which then applies its expression or operations.

  24. 24

    Which description best captures what a function does in R?

    1. A

      It applies specified operations to input data and can produce a result.

    2. B

      It stores a table without allowing operations on the data.

    3. C

      It installs a programming language on the computer.

    4. D

      It changes every input into a character string.

    Correct answer
    A

    It applies specified operations to input data and can produce a result.

    Explanation

    Functions act on data and produce results according to the operations specified in their definition.

  25. 25

    Why does the greeting function use quotation marks around "Hello World!"?

    1. A

      Quotation marks cause R to install a greeting package.

    2. B

      Quotation marks are required only when defining matrices.

    3. C

      Quotation marks identify the text as a string rather than a variable name.

    4. D

      Quotation marks tell R to treat the text as a numeric value.

    Correct answer
    C

    Quotation marks identify the text as a string rather than a variable name.

    Explanation

    Text written in quotation marks is treated as a character string, not as the name of an object.

  26. 26

    What role do if, else if, and else statements play in the BMI function example?

    1. A

      They select different actions or messages depending on the BMI conditions.

    2. B

      They install and load packages needed for calculating BMI.

    3. C

      They convert a BMI result into a data frame.

    4. D

      They combine multiple vectors into a list.

    Correct answer
    A

    They select different actions or messages depending on the BMI conditions.

    Explanation

    Conditional statements let the function check BMI ranges and print messages appropriate to the result.

  27. 27

    What does a default argument such as print.median = FALSE imply in a function?

    1. A

      The function will always print the median, even if told not to.

    2. B

      The function cannot accept a vector as input.

    3. C

      The function will omit the median unless the user requests it.

    4. D

      The function will calculate neither the mean nor the standard deviation.

    Correct answer
    C

    The function will omit the median unless the user requests it.

    Explanation

    A FALSE default means the median is not printed unless the argument is explicitly set to TRUE.

  28. 28

    Why should separate commands in a multi-line function be clearly separated?

    1. A

      R permits only one assignment in each function.

    2. B

      Separate lines convert numeric values into character values.

    3. C

      R needs to recognize where one operation ends and the next begins.

    4. D

      Every new line automatically creates a different function.

    Correct answer
    C

    R needs to recognize where one operation ends and the next begins.

    Explanation

    Clear command separation helps R interpret each assignment and operation as intended.

  29. 29

    What is the purpose of the data model described in the workshop?

    1. A

      To organize the steps that turn raw data into results and communicable tables or figures.

    2. B

      To choose a machine-learning algorithm before examining any data.

    3. C

      To ensure that every dataset can be analyzed without preprocessing.

    4. D

      To replace data collection with statistical modeling.

    Correct answer
    A

    To organize the steps that turn raw data into results and communicable tables or figures.

    Explanation

    The model describes a workflow from obtaining data through processing, analysis, visualization, and communication.

  30. 30

    Which sequence best reflects the data workflow presented in the workshop?

    1. A

      Model data, communicate results, import data, and then decide whether to clean it.

    2. B

      Visualize data, discard the raw data, and then import the model output.

    3. C

      Communicate results, import data, and avoid further analysis.

    4. D

      Import data, tidy or transform it, visualize it, model it, and communicate results.

    Correct answer
    D

    Import data, tidy or transform it, visualize it, model it, and communicate results.

    Explanation

    The workflow includes importing, cleaning or transforming, visualizing, modeling, and communicating data and results.

  31. 31

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

    1. A

      To make the dataset contain only one variable.

    2. B

      To guarantee that the analysis will produce statistically significant results.

    3. C

      To replace the original observations with model predictions.

    4. D

      To clean or reshape the table into a form suitable for the intended analysis.

    Correct answer
    D

    To clean or reshape the table into a form suitable for the intended analysis.

    Explanation

    Tidying and transformation prepare data by cleaning or reshaping it for analysis.

  32. 32

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

    1. A

      Installation runs the package's functions; loading permanently saves a dataset.

    2. B

      Installation adds the package to the computer; loading makes it available in the current R session.

    3. C

      Installation creates a plot; loading converts the plot into a data frame.

    4. D

      Installation and loading are identical steps that must be done only once.

    Correct answer
    B

    Installation adds the package to the computer; loading makes it available in the current R session.

    Explanation

    The workshop uses install.package() to obtain a package and library() to load an installed package for use.

  33. 33

    Why use library(tidyverse) after installing tidyverse?

    1. A

      It loads the installed package so its tools can be used in the session.

    2. B

      It automatically runs every data-cleaning function in the package.

    3. C

      It converts the current working directory into a package.

    4. D

      It downloads the dataset from the internet without reading a file.

    Correct answer
    A

    It loads the installed package so its tools can be used in the session.

    Explanation

    The library() function loads an installed package into the current R session.

  34. 34

    Which tidyverse package was identified as useful for importing CSV files?

    1. A

      readr

    2. B

      ggplot2

    3. C

      tidyr

    4. D

      dplyr

    Correct answer
    A

    readr

    Explanation

    The workshop identifies readr as the tidyverse package used for data import, including the read_csv() function.

  35. 35

    Which set of variables was described as appearing in the gapminder dataset?

    1. A

      Country, age, income, treatment, diagnosis, and test score.

    2. B

      Person, date, weight, height, BMI, and exercise level.

    3. C

      City, month, rainfall, temperature, longitude, and latitude.

    4. D

      Country, year, population, continent, life expectancy, and GDP per capita.

    Correct answer
    D

    Country, year, population, continent, life expectancy, and GDP per capita.

    Explanation

    The six variables listed for gapminder are country, year, population, continent, lifeExp, and gdpPercap.

  36. 36

    What does dim(gapminder) provide?

    1. A

      The names of all countries in the dataset.

    2. B

      A summary of the mean for each numeric variable.

    3. C

      The first six observations and their values.

    4. D

      The number of rows and columns in the dataset.

    Correct answer
    D

    The number of rows and columns in the dataset.

    Explanation

    The dim() function reports a dataset's dimensions, such as its row and column counts.

  37. 37

    How do head() and tail() differ when used on a dataset?

    1. A

      head() displays columns, while tail() displays only row numbers.

    2. B

      head() displays the first rows, while tail() displays the last rows.

    3. C

      head() displays variable names, while tail() displays variable classes.

    4. D

      head() removes missing values, while tail() counts them.

    Correct answer
    B

    head() displays the first rows, while tail() displays the last rows.

    Explanation

    The workshop uses head() to inspect the first six rows and tail() to inspect the last six rows.

  38. 38

    What does names(gapminder) return?

    1. A

      The number of rows in the dataset.

    2. B

      The average of all numeric variables.

    3. C

      The unique values of the country variable.

    4. D

      The names of the dataset's variables.

    Correct answer
    D

    The names of the dataset's variables.

    Explanation

    The names() function returns the variable names in a data frame.

  39. 39

    Why can mean(age) return a missing result if age contains NA?

    1. A

      The mean function accepts only character vectors.

    2. B

      NA values are interpreted as zeros and make the vector nonnumeric.

    3. C

      The mean calculation encounters a missing value and, by default, does not remove it.

    4. D

      The mean function automatically filters out every observation.

    Correct answer
    C

    The mean calculation encounters a missing value and, by default, does not remove it.

    Explanation

    By default, mean() does not remove missing values, so an NA in the input can make the result NA.

  40. 40

    How can mean() calculate an average while excluding missing values?

    1. A

      Convert the vector to a matrix before calling mean().

    2. B

      Set na.rm = TRUE in the mean() call.

    3. C

      Set na.rm = FALSE in the mean() call.

    4. D

      Use head() to remove the missing observations.

    Correct answer
    B

    Set na.rm = TRUE in the mean() call.

    Explanation

    Setting na.rm = TRUE tells mean() to remove NA values before calculating.

  41. 41

    How would you create a dataset containing only gapminder observations from 2007?

    1. A

      Use names() to rename every year value as 2007.

    2. B

      Use filter() to keep rows whose year equals 2007.

    3. C

      Use mean() to average the year variable.

    4. D

      Use dim() to select rows with six columns.

    Correct answer
    B

    Use filter() to keep rows whose year equals 2007.

    Explanation

    The filter() function selects rows satisfying a condition, such as year == 2007.

  42. 42

    What is the purpose of selecting rows where continent equals Asia?

    1. A

      To create a subset containing observations for the Asian continent.

    2. B

      To calculate the average population of every continent.

    3. C

      To rename the continent variable as Asia for every observation.

    4. D

      To convert all country names into numeric values.

    Correct answer
    A

    To create a subset containing observations for the Asian continent.

    Explanation

    Filtering on continent == "Asia" retains the observations identified as belonging to Asia.

  43. 43

    Why might a researcher filter gapminder for population above ten million?

    1. A

      To calculate the total number of countries in the dataset.

    2. B

      To create a subset focused on observations meeting a population threshold.

    3. C

      To transform population into a categorical variable automatically.

    4. D

      To replace population values with the number ten million.

    Correct answer
    B

    To create a subset focused on observations meeting a population threshold.

    Explanation

    A filter condition can select rows with population greater than a chosen threshold.

  44. 44

    Why is data visualization valuable when exploring or communicating results?

    1. A

      A graph ensures that every viewer reaches the same interpretation.

    2. B

      A graph guarantees that an observed pattern is statistically significant.

    3. C

      Visual displays make it unnecessary to inspect or analyze the data.

    4. D

      Visual displays can make patterns easier to perceive than text or raw data alone.

    Correct answer
    D

    Visual displays can make patterns easier to perceive than text or raw data alone.

    Explanation

    The workshop emphasizes that visual representations can communicate concepts quickly and make patterns easier to see.

  45. 45

    What does the workshop mean by describing ggplot2 as a layer-based plotting system?

    1. A

      Each plot must be made from a different dataset and cannot be modified.

    2. B

      Each layer replaces the previous one rather than contributing to the figure.

    3. C

      A plot's axes are added only after the graph has been exported.

    4. D

      A plot can be built by adding components such as points or other graphical elements.

    Correct answer
    D

    A plot can be built by adding components such as points or other graphical elements.

    Explanation

    ggplot2 builds figures by combining a data mapping with additional layers, such as geometries.

  46. 46

    In ggplot(gapminder, aes(x = gdpPercap, y = lifeExp)), what does aes() specify?

    1. A

      Which package should be installed before plotting.

    2. B

      Which rows should be removed from the dataset.

    3. C

      Which statistical test should be applied to the variables.

    4. D

      Which data variables are mapped to the plot's visual properties, such as the axes.

    Correct answer
    D

    Which data variables are mapped to the plot's visual properties, such as the axes.

    Explanation

    The aesthetics mapping assigns gdpPercap to the x-axis and lifeExp to the y-axis.

  47. 47

    Which geometry adds a scatter plot of individual data points in ggplot2?

    1. A

      geom_histogram()

    2. B

      geom_boxplot()

    3. C

      geom_line()

    4. D

      geom_point()

    Correct answer
    D

    geom_point()

    Explanation

    The workshop uses geom_point() to add one plotted point for each observation.

  48. 48

    What does setting alpha to 0.5 for points generally do?

    1. A

      It changes the x-axis into a categorical variable.

    2. B

      It doubles the number of observations shown.

    3. C

      It removes points that overlap.

    4. D

      It makes the points partially transparent.

    Correct answer
    D

    It makes the points partially transparent.

    Explanation

    The alpha setting controls transparency; an alpha level of 0.5 makes points partly transparent.

  49. 49

    How can continent be shown using different point colors in the scatter plot?

    1. A

      Replace geom_point() with mean().

    2. B

      Use dim() to assign a color to each row.

    3. C

      Set the data argument to continent only.

    4. D

      Map continent to the color aesthetic.

    Correct answer
    D

    Map continent to the color aesthetic.

    Explanation

    Mapping color to continent lets the plot distinguish observations by their continent category.

  50. 50

    Which plot type was used to compare life expectancy distributions across continents?

    1. A

      A line plot of variable names.

    2. B

      A scatter plot with no grouping.

    3. C

      A histogram.

    4. D

      A box plot.

    Correct answer
    D

    A box plot.

    Explanation

    The workshop uses a box plot to compare life expectancy distributions across continents.

  51. 51

    What is a histogram used to display in the life expectancy example?

    1. A

      The relationship between each country's GDP and population.

    2. B

      The counts of observations across values or intervals of life expectancy.

    3. C

      The names of countries ranked by continent.

    4. D

      The median life expectancy for each year only.

    Correct answer
    B

    The counts of observations across values or intervals of life expectancy.

    Explanation

    A histogram shows the frequency or count of observations across the values of a variable.

  52. 52

    What kind of relationship can a scatter plot of GDP per capita and life expectancy help reveal?

    1. A

      Whether the dataset contains missing values in all variables.

    2. B

      Whether country names determine the number of dataset columns.

    3. C

      Whether higher GDP per capita tends to coincide with higher life expectancy.

    4. D

      Whether life expectancy is the same for every observation.

    Correct answer
    C

    Whether higher GDP per capita tends to coincide with higher life expectancy.

    Explanation

    The plotted pattern can help reveal an association between GDP per capita and life expectancy.

  53. 53

    What information can point size represent in a scatter plot, as in the workshop's example?

    1. A

      The statistical significance of every observation.

    2. B

      The number of layers in the plot.

    3. C

      An additional variable such as population.

    4. D

      The name of the selected plotting package.

    Correct answer
    C

    An additional variable such as population.

    Explanation

    The example uses point size to convey population, allowing a third variable to be represented in the plot.

  54. 54

    What does the workshop suggest a viewer can learn from a multivariate visualization?

    1. A

      It can prove the causal effect of one plotted variable on another.

    2. B

      It can show several patterns at once, such as associations and differences among groups.

    3. C

      It can replace all descriptive and inferential statistical analysis.

    4. D

      It can guarantee that the variables were measured without error.

    Correct answer
    B

    It can show several patterns at once, such as associations and differences among groups.

    Explanation

    A well-designed figure can reveal multiple features of the data, but visual patterns alone do not establish causation.

  55. 55

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

    1. A

      A summary of each variable, including descriptive statistics for numeric variables.

    2. B

      A filtered dataset containing only complete observations.

    3. C

      A list of all functions available in R.

    4. D

      A graph showing every pairwise relationship among variables.

    Correct answer
    A

    A summary of each variable, including descriptive statistics for numeric variables.

    Explanation

    The workshop uses summary() to obtain information about each variable, including statistics such as means and medians for numeric variables.

  56. 56

    How can a researcher obtain summaries separately for each continent?

    1. A

      Use a grouping or by operation that applies summary to each continent's data.

    2. B

      Use read_csv() to split the data into continent groups.

    3. C

      Use names() to assign each continent a different summary value.

    4. D

      Use dim() to calculate separate means for each continent.

    Correct answer
    A

    Use a grouping or by operation that applies summary to each continent's data.

    Explanation

    The workshop demonstrates applying summary by continent to obtain summaries for each group.

  57. 57

    How can R be used to count the number of distinct countries in gapminder?

    1. A

      Find unique country values and apply length() to that result.

    2. B

      Use head() and multiply the displayed rows by six.

    3. C

      Use class() on the country variable and count its data type.

    4. D

      Apply mean() to the country names and count the decimal places.

    Correct answer
    A

    Find unique country values and apply length() to that result.

    Explanation

    unique() returns distinct values, and length() counts the values in that result; the workshop reports 142 countries.

  58. 58

    What does the expression gapminder$country select?

    1. A

      Every row in gapminder that contains a dollar amount.

    2. B

      The country with the highest population.

    3. C

      The country variable from the gapminder data frame.

    4. D

      The statistical model fitted to gapminder.

    Correct answer
    C

    The country variable from the gapminder data frame.

    Explanation

    The dollar-sign notation accesses a named variable, such as country, within a data frame.

  59. 59

    What does a correlation value of about 0.58 between GDP per capita and life expectancy indicate?

    1. A

      There is no relationship between the variables.

    2. B

      The two variables are identical for every observation.

    3. C

      GDP per capita causes a 58 percent increase in life expectancy.

    4. D

      The variables have a positive association in the analyzed data.

    Correct answer
    D

    The variables have a positive association in the analyzed data.

    Explanation

    A positive correlation indicates that higher values of one variable tend to be associated with higher values of the other; it does not establish causation.

  60. 60

    Why would a researcher filter the data to Europe and Asia before comparing their life expectancies with a t-test?

    1. A

      The subset ensures the comparison focuses on observations from the two continents of interest.

    2. B

      Filtering guarantees that the groups have equal means.

    3. C

      Filtering makes the test paired by matching every country automatically.

    4. D

      Filtering converts the life expectancy variable into a categorical variable.

    Correct answer
    A

    The subset ensures the comparison focuses on observations from the two continents of interest.

    Explanation

    Filtering selects the groups to be compared; the t-test then evaluates their life expectancy difference.

  61. 61

    In the Europe-versus-Asia t-test described, what does a negative t-value indicate in the present comparison?

    1. A

      The data contain a negative number of observations.

    2. B

      The estimated difference has the direction associated with Europe having higher life expectancy than Asia under the test's group ordering.

    3. C

      The test proves that the groups have exactly equal means.

    4. D

      The p-value must be greater than the chosen significance threshold.

    Correct answer
    B

    The estimated difference has the direction associated with Europe having higher life expectancy than Asia under the test's group ordering.

    Explanation

    The presenter interprets the negative t-value in this comparison as indicating higher life expectancy for Europe than Asia, given the way the groups are ordered.

  62. 62

    What does paired = TRUE specify in the t-test comparing 2002 and 2007?

    1. A

      The analysis should treat the observations from the two years as paired.

    2. B

      The data should be filtered to include only one year.

    3. C

      The two years should be treated as unrelated groups.

    4. D

      The test should compare the years' population totals instead of life expectancy.

    Correct answer
    A

    The analysis should treat the observations from the two years as paired.

    Explanation

    The paired = TRUE argument requests a paired-sample t-test for the comparison.

  63. 63

    Why does the workshop convert year to a factor before comparing 2002 and 2007?

    1. A

      To calculate a continuous trend from the two years.

    2. B

      To treat the year values as categories rather than as numeric measurements.

    3. C

      To ensure that every country appears in only one year.

    4. D

      To remove the year variable from the dataset.

    Correct answer
    B

    To treat the year values as categories rather than as numeric measurements.

    Explanation

    The year values are numeric, so converting them to a factor makes them function as categorical group labels.

  64. 64

    In the linear model lifeExp predicted by population, GDP per capita, and year, what are those three variables serving as?

    1. A

      Alternative names for the model residuals.

    2. B

      Categories of the response variable.

    3. C

      Output statistics calculated after fitting the model.

    4. D

      Predictors of life expectancy.

    Correct answer
    D

    Predictors of life expectancy.

    Explanation

    The model uses population, GDP per capita, and year to predict the outcome lifeExp.

  65. 65

    What does a model residual represent?

    1. A

      The correlation between two input variables.

    2. B

      The average value of every predictor in the dataset.

    3. C

      The number of groups used in a t-test.

    4. D

      The part of an observation's outcome not explained by the fitted model.

    Correct answer
    D

    The part of an observation's outcome not explained by the fitted model.

    Explanation

    Residuals represent unexplained variation: the differences between observed outcomes and the model's fitted values.

  66. 66

    What does an adjusted R2R^2R2 of about 0.439 indicate in the workshop's interpretation?

    1. A

      The model accounts for about 44% of the outcome variance, under the stated interpretation.

    2. B

      The model predicts exactly 44% of individual observations correctly.

    3. C

      The model has a 44% probability of being statistically significant.

    4. D

      The predictors explain 44% of the missing values in the dataset.

    Correct answer
    A

    The model accounts for about 44% of the outcome variance, under the stated interpretation.

    Explanation

    The presenter interprets the adjusted R2R^2R2 of 0.4392 as the model explaining about 44% of the variance.

  67. 67

    What can be done with model coefficients after fitting a linear model in R?

    1. A

      They can be extracted only by rebuilding the model in a menu-based program.

    2. B

      They can be used to recover every missing value with certainty.

    3. C

      They can be extracted from the model object for inspection or further use.

    4. D

      They automatically replace the original observations in the dataset.

    Correct answer
    C

    They can be extracted from the model object for inspection or further use.

    Explanation

    The workshop shows extracting coefficients from a fitted model object, illustrating how R can provide specific model results.

  68. 68

    What is the purpose of comments in an R script?

    1. A

      To convert a script into a package automatically.

    2. B

      To remove the need to use meaningful variable names.

    3. C

      To make R execute an additional hidden analysis.

    4. D

      To explain the code or the information a command is intended to provide.

    Correct answer
    D

    To explain the code or the information a command is intended to provide.

    Explanation

    Comments document code for readers; they describe what a command or analysis does rather than running it.

  69. 69

    What does R Markdown allow a researcher to combine?

    1. A

      A data frame with a computer operating system.

    2. B

      A graphical menu with an automatically selected hypothesis.

    3. C

      A written document with programming and analysis results.

    4. D

      An R package with an online search engine.

    Correct answer
    C

    A written document with programming and analysis results.

    Explanation

    The workshop describes R Markdown as a way to create a document that includes programming and results.

  70. 70

    Which pattern distinguishes the big-data example from the typical experiment described?

    1. A

      Big data may contain many variables but comparatively fewer subjects, while experiments often have many subjects and fewer variables.

    2. B

      Big data and experiments necessarily have identical numbers of subjects and variables.

    3. C

      Big data always has more subjects and fewer variables than an experiment.

    4. D

      Big data contains no variables, while experiments contain only variables.

    Correct answer
    A

    Big data may contain many variables but comparatively fewer subjects, while experiments often have many subjects and fewer variables.

    Explanation

    The workshop contrasts experiment-generated data, often with many subjects and few variables, with big data that may have many variables and fewer subjects.

  71. 71

    Why can feature reduction be important when analyzing high-dimensional big data?

    1. A

      It increases the number of subjects in the dataset.

    2. B

      It changes an unsupervised task into a supervised one automatically.

    3. C

      It guarantees that the remaining variables are causal.

    4. D

      It can help select a manageable set of variables for prediction or analysis.

    Correct answer
    D

    It can help select a manageable set of variables for prediction or analysis.

    Explanation

    The workshop notes that big data can have many variables and that machine-learning approaches may reduce or select features.

  72. 72

    What is machine learning, as described in the workshop?

    1. A

      A statistical test used only to compare two group means.

    2. B

      A set of general algorithms that learn patterns from data rather than being fully specified for one phenomenon.

    3. C

      A method that uses only fixed rules written in advance and ignores data.

    4. D

      A type of dataset that contains more subjects than variables.

    Correct answer
    B

    A set of general algorithms that learn patterns from data rather than being fully specified for one phenomenon.

    Explanation

    Machine-learning algorithms learn from data and are not necessarily written for one specific phenomenon or research question.

  73. 73

    According to the workshop, how can more information affect a machine-learning algorithm?

    1. A

      More information always makes performance worse.

    2. B

      More information guarantees perfect predictions.

    3. C

      More information eliminates the need to evaluate the algorithm.

    4. D

      More information can improve performance, although the quality and relevance of the data still matter.

    Correct answer
    D

    More information can improve performance, although the quality and relevance of the data still matter.

    Explanation

    The workshop notes that additional information can lead to higher algorithm performance, while also cautioning that more data is not necessarily better data.

  74. 74

    What is the goal of a classification problem?

    1. A

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

    2. B

      Calculate the mean and standard deviation of a vector.

    3. C

      Estimate a continuous numerical outcome from predictors.

    4. D

      Find hidden groups using input data without known categories.

    Correct answer
    A

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

    Explanation

    Classification identifies which category or class an observation belongs to based on its features.

  75. 75

    What is the goal of a regression problem in machine learning?

    1. A

      Use features to predict an outcome, potentially for new samples.

    2. B

      Assign each observation to a known category only.

    3. C

      Find groups without using output labels.

    4. D

      Display the distribution of one variable as bars.

    Correct answer
    A

    Use features to predict an outcome, potentially for new samples.

    Explanation

    Regression builds a predictive model from features to an outcome and can be applied to new samples.

  76. 76

    What is the purpose of clustering?

    1. A

      Assign observations to categories that were specified in advance.

    2. B

      Predict a known continuous outcome using labeled examples only.

    3. C

      Identify groups or hidden structure based on similarities among observations.

    4. D

      Test whether two group means are significantly different.

    Correct answer
    C

    Identify groups or hidden structure based on similarities among observations.

    Explanation

    Clustering seeks hidden patterns or structure by grouping observations according to similarity.

  77. 77

    Which pair of methods is presented as supervised learning?

    1. A

      Clustering and descriptive summaries.

    2. B

      Classification and regression.

    3. C

      Tidying and importing.

    4. D

      Clustering and visualization.

    Correct answer
    B

    Classification and regression.

    Explanation

    The workshop identifies classification and regression as supervised methods that use input and output information to build predictive models.

  78. 78

    Why is clustering classified as unsupervised learning?

    1. A

      It predicts a labeled outcome from both inputs and outputs.

    2. B

      It requires the researcher to specify the correct class for every observation.

    3. C

      It groups or interprets data using input data without relying on known output labels.

    4. D

      It compares the means of two predefined groups.

    Correct answer
    C

    It groups or interprets data using input data without relying on known output labels.

    Explanation

    Clustering is unsupervised because it searches for structure using input data without known output labels.

  79. 79

    How does the workshop distinguish inference from prediction?

    1. A

      Inference and prediction are identical tasks with different names.

    2. B

      Inference uses only big data, while prediction uses only small experiments.

    3. C

      Inference builds a model to understand or test how a system behaves, while prediction forecasts unobserved outcomes.

    4. D

      Inference forecasts future cases, while prediction only summarizes past data.

    Correct answer
    C

    Inference builds a model to understand or test how a system behaves, while prediction forecasts unobserved outcomes.

    Explanation

    Inference focuses on formalizing understanding or testing hypotheses about a data-generating system; prediction focuses on forecasting unobserved outcomes or future behavior.

  80. 80

    Which comparison between classical statistics and machine learning matches the workshop's emphasis?

    1. A

      Classical statistics is often strong for inference and understanding, while machine learning is often strong for prediction.

    2. B

      Classical statistics is always more accurate, regardless of the question or data.

    3. C

      Classical statistics requires big data, while machine learning requires only laboratory data.

    4. D

      Classical statistics cannot make predictions, while machine learning cannot support inference.

    Correct answer
    A

    Classical statistics is often strong for inference and understanding, while machine learning is often strong for prediction.

    Explanation

    The workshop presents classical statistics as particularly suited to understanding behavior and testing hypotheses, and machine learning as particularly suited to prediction, while noting that the boundary is not clear-cut.

  81. 81

    What lesson does the Google Flu Trends example illustrate?

    1. A

      Public awareness changed search behavior, which weakened the relationship between searches and flu activity.

    2. B

      A large dataset cannot be affected by changes in human behavior.

    3. C

      Search data always provide a more accurate estimate of flu than public health data.

    4. D

      Media attention caused the CDC to stop recording influenza activity.

    Correct answer
    A

    Public awareness changed search behavior, which weakened the relationship between searches and flu activity.

    Explanation

    After the prediction system received media attention, more people searched for flu-related information, including people without flu symptoms, which led to overprediction.

  82. 82

    What broader conclusion does the Google Flu Trends case support?

    1. A

      Large amounts of data do not automatically make data better or predictions more reliable.

    2. B

      Traditional data collection should always be replaced by online data.

    3. C

      Search behavior is always a direct measure of disease incidence.

    4. D

      Predictive models cannot be affected by changes in public behavior.

    Correct answer
    A

    Large amounts of data do not automatically make data better or predictions more reliable.

    Explanation

    The case shows that data features and the way they are generated must be considered; more data alone does not guarantee better data.

  83. 83

    How does the workshop recommend using big data in relation to experimental research?

    1. A

      Use it to generate novel hypotheses, then test those hypotheses with experiments when appropriate.

    2. B

      Use it only after an experiment has proven every possible relationship.

    3. C

      Avoid using it because it cannot provide useful insight.

    4. D

      Use it to replace all experiments and confirm every causal claim.

    Correct answer
    A

    Use it to generate novel hypotheses, then test those hypotheses with experiments when appropriate.

    Explanation

    The presenter favors using big data to generate hypotheses and then conducting experiments to confirm them.

  84. 84

    What is a central reason the workshop gives for learning R in preparation for data challenges?

    1. A

      R supports reproducible research and provides tools for working with data, including large datasets.

    2. B

      R can be used only for small, manually entered datasets.

    3. C

      R ensures that every big-data project avoids bias.

    4. D

      R removes the need to assess whether a method is legitimate.

    Correct answer
    A

    R supports reproducible research and provides tools for working with data, including large datasets.

    Explanation

    The workshop presents R as useful for reproducible research and as a way to prepare for big-data challenges, while still urging care about methods and data quality.

Question 1 of 84
Question 1 of 84

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent