Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

R language Question 3 For the following questions, use the uspop data. Info on that dataset can be found: ?uspop head(uspop) Question 3A Find the

R language

image text in transcribed

image text in transcribed

Question 3 For the following questions, use the uspop data. Info on that dataset can be found: ?uspop head(uspop) Question 3A Find the least squares regression equation between the x variable time (years) and the y variable US population from the uspop dataset. Set up variable x so that it starts in the year 1850 and ends in the year 1970 by increments of 10 years. i.e. x = {1850, 1860, 1870, ..., 1960, 1970). Set up variable y outputs to be consistent with variable x. For the answer, assign the y-intercept as bo and the slope as bi. # your code here fail # No Answer - remove if you provide an answer ## question 3a - check whether bO and bi are defined and type double length 1 test_that (desc="b1 is missing or not type double", code={ expect_equal (typeof (61), "double) }) test_that (desc="bl is missing or not length 1", code={ expect_equal (length(bi), 1) test_that (desc="b1 is wrong", code=1 expect_equal (round (as. numeric (61), 2), 1. 46) }) test_that (desc="b0 is missing or not type double", code- expect_equal (typeof (60). "double") }) test_that (desc="bo is missing or not length 1", code= { expect_equal (length(bl). 1) Question 3B Find the p-value for the slope from part A. Assign the value as pval. #your code here fail # No Answer remove if you provide an answer ## question 3b - check whether pval is defined and length 1 test_that (desc="pval is not defined or not length 1", code={ expect_equal (length(pval), 1) }) Question 3C Is there evidence of a linear relationship between year and US population between the years 1850 and 1970? Answer character value "t" for true and character value "f" for false, assign variable to ans. # your code here fail() # No Answer - remove if you provide an answer ## question 30 check dimension and output of ans test_that (desc="dimension of ans is incorrect", code={ expect_equal (length(ans), 1) }) test_that (desc="dimension of ans is either t or f, code={ expect_equal (ans == "f" ans == "t", TRUE) }) Question 3 For the following questions, use the uspop data. Info on that dataset can be found: ?uspop head(uspop) Question 3A Find the least squares regression equation between the x variable time (years) and the y variable US population from the uspop dataset. Set up variable x so that it starts in the year 1850 and ends in the year 1970 by increments of 10 years. i.e. x = {1850, 1860, 1870, ..., 1960, 1970). Set up variable y outputs to be consistent with variable x. For the answer, assign the y-intercept as bo and the slope as bi. # your code here fail # No Answer - remove if you provide an answer ## question 3a - check whether bO and bi are defined and type double length 1 test_that (desc="b1 is missing or not type double", code={ expect_equal (typeof (61), "double) }) test_that (desc="bl is missing or not length 1", code={ expect_equal (length(bi), 1) test_that (desc="b1 is wrong", code=1 expect_equal (round (as. numeric (61), 2), 1. 46) }) test_that (desc="b0 is missing or not type double", code- expect_equal (typeof (60). "double") }) test_that (desc="bo is missing or not length 1", code= { expect_equal (length(bl). 1) Question 3B Find the p-value for the slope from part A. Assign the value as pval. #your code here fail # No Answer remove if you provide an answer ## question 3b - check whether pval is defined and length 1 test_that (desc="pval is not defined or not length 1", code={ expect_equal (length(pval), 1) }) Question 3C Is there evidence of a linear relationship between year and US population between the years 1850 and 1970? Answer character value "t" for true and character value "f" for false, assign variable to ans. # your code here fail() # No Answer - remove if you provide an answer ## question 30 check dimension and output of ans test_that (desc="dimension of ans is incorrect", code={ expect_equal (length(ans), 1) }) test_that (desc="dimension of ans is either t or f, code={ expect_equal (ans == "f" ans == "t", TRUE) })

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions