Question 1: (2 points) You want to describe the data frame “households” using the function describe(households). You have installed the packages shown below, but you get an error when running...

1 answer below »
Please see attachment. multiple choice/true and false questions on programming languages of R and SAS. Introductory level class on 'biostatistical computing'.


Question 1: (2 points) You want to describe the data frame “households” using the function describe(households). You have installed the packages shown below, but you get an error when running describe(households) as shown at the bottom of the Console window. Select the correct answer a) You forgot to install the correct package that contains the describe() function, and you don’t have it installed already in RStudio. b) You misspelled the name of the function. c) You forgot to call the library(Hmisc). d) You forgot to call the library(ggplot2). Question 2 2.1 (1 point) Libraries have the same function in both SAS and R. a) True b) False 2.2 (2 point) Briefly explain your answer. Question 3 You read a datafile into R that contains the variables Total_Weight and Total_Fat and you calculate total_lean as follows total_lean <- total_weight="" –="" total_fat="" 3.1="" (1="" point)="" the="" command="" as="" written="" will="" not="" work,="" and="" the="" variable="" total_lean="" will="" not="" be="" created.="" a)="" true="" b)="" false="" 3.2="" (1="" point)="" briefly="" explain="" your="" answer.="" question="" 4:="" (2="" points)="" the="" dataframe="" households="" contains="" a="" variable="" called="" decade_built.="" it="" is="" the="" decade="" houses="" were="" built,="" but="" it’s="" defined="" as="" numeric:="" col_double().="" we="" want="" to="" define="" it="" as="" factor="" so="" it="" can="" be="" use="" it="" correctly="" in="" ggplot().="" select="" the="" correct="" answer="" on="" how="" to="" obtain="" a="" factor="" variable="" from="" the="" numeric="" variable="" decade_built:="" a)="" households$decade_builtnew=""><- as.factor(households$decade_built)="" b)="" decade_builtnew=""><- as.factor(decade_built)="" c)="" decade_built="" cannot="" be="" defined="" as="" factor="" d)="" households$decade_builtnew=""><- as.factor(decade_built)="" question="" 5:="" (2="" points)="" below="" is="" the="" sas="" output="" of="" proc="" contents="" and="" a="" cross="" tab="" using="" proc="" freq.="" variables="" in="" creation="" order="" #="" variable="" type="" len="" format="" label="" 1="" subject="" num="" 8=""  ="" subject="" number="" 2="" gender="" char="" 8=""  ="" gender="" of="" subject="" 3="" measwt="" num="" 8=""  ="" measured="" weight="" 4="" measht="" num="" 8=""  ="" measured="" height="" 5="" reptwt="" num="" 8=""  ="" reported="" weight="" 6="" reptht="" num="" 8=""  ="" reported="" height="" 7="" female="" num="" 8="" fm.=""  ="" table="" of="" female="" by="" gender="" female="" gender(gender="" of="" subject)="" frequency‚="" percent="" ‚="" row="" pct="" ‚="" col="" pct="" ‚f="" ‚m="" ‚="" total="" ƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆ="" male="" ‚="" 0="" ‚="" 88="" ‚="" 88="" ‚="" 0.00="" ‚="" 44.00="" ‚="" 44.00="" ‚="" 0.00="" ‚="" 100.00="" ‚="" ‚="" 0.00="" ‚="" 100.00="" ‚="" ƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆ="" female="" ‚="" 112="" ‚="" 0="" ‚="" 112="" ‚="" 56.00="" ‚="" 0.00="" ‚="" 56.00="" ‚="" 100.00="" ‚="" 0.00="" ‚="" ‚="" 100.00="" ‚="" 0.00="" ‚="" ƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒˆ="" total="" 112="" 88="" 200="" 56.00="" 44.00="" 100.00="" select="" the="" correct="" answer:="" a)="" female="" and="" gender="" are="" both="" character="" variables.="" b)="" female="" and="" gender="" contain="" the="" same="" information,="" but="" gender="" is="" a="" character="" variable,="" and="" female="" is="" a="" formatted="" numeric="" variable.="" c)="" female="" and="" gender="" contain="" the="" same="" information,="" but="" gender="" is="" a="" character="" variable,="" and="" female="" is="" an="" unformatted="" numeric="" variable.="" question="" 6:="" (2="" points)="" below="" is="" the="" partial="" output="" of="" proc="" univariate="" in="" sas:="" proc="" univariate;="" var="" pad645;="" run;="" variable:="" pad645="" (minutes="" walk/bicycle="" for="" transportation)="" quantiles (definition 5)="" level="" quantile="" 100%="" max="" 1200="" 99%="" 360="" 95%="" 180="" 90%="" 120="" 75%="" q3="" 60="" 50%="" median="" 30="" 25%="" q1="" 20="" 10%="" 13="" 5%="" 10="" 1%="" 10="" 0%="" min="" 10="" missing="" values="" missing="" value="" count="" percent="" of="" all="" obs="" missing="" obs="" .="" 1953="" 82.97="" 100.00="" you="" are="" asked="" to="" create="" a="" binary="" variable="" called="" more_than_1hour="" defined="" as="" 1="" if="" the="" person="" reports="" walking/bicycling="" more="" than="" 60="" minutes,="" and="" 0="" if="" the="" person="" reports="" walking/bicycling="" 60="" minutes="" or="" less.="" you="" write="" the="" code="" more_than_1hour=".;" if="" pad645=""> 60 then more_than_1hour = 1; else if PAD645 <= 60 then more_than_1hour = 0; the sas code is correct a) true b) false question 7 these sub-questions relate to concatenating/appending files in sas. 7.1 (2 points) you can concatenate two files called file1 and file2 with exactly the same variables but different observation, using the set command in the data step as follows: data all; set file1 file2; run; a) true b) false 7.2 (1 points) you can also concatenate two files called file1 and file2 with some common variables and some different variables and different observation, using the set command in the data step shown in 7.1. the resulting file will have missing values for the variables that are not common to the 2 files. a) true b) false 7.3 (1 points) you need to sort the datasets first by a key variable (like patient_id, say) in order to concatenate files in sas using the set command in the data step, or the resulting data file will be incorrect. a) true b) false question 8: (3 points) in order to merge 2 or more files in sas using the merge command in the data step, is good practice to sort them first by the variable (or variables) you are merging them on using proc sort, or you might get the wrong resulting file. a) true b) false question 9: (2 points) you imported the .csv file households.csv into sas as shown below. select the correct answer. select the correct answer a) the dataset you created is called households and it’s stored in the library final, and a sas datafile has been created and saved in the directory c:\users\ybarr\biostat 0535 spring 2020\final exam b) the dataset you created is called final. c) the dataset you created is called households and it’s stored in the library work, and a sas datafile has been created and saved in the directory c:\users\ybarr\biostat 0535 spring 2020\final exam d) the dataset you created is called households and it’s stored in the library work, but no sas datafile has yet been created in the directory c:\users\ybarr\biostat 0535 spring 2020\final exam question 10: (2 points) a sas date is a value that represents the number of days between january 1, 1960, and a specified date. a) true b) false question 11: (2 points) if variables in a data frame have missing values a) ggplot will ignore the missing values and produce the correct plot without the missing values. b) the code will not work at all and it will produce an error message. c) na.omit will have to be included in the data section of ggplot listing all the variables used in the plot, to obtain the desired plot. d) na.omit will have to be included in the aes section of ggplot listing all the variables used in the plot, to obtain the desired plot. question 12: (2 points) to create side by side plots stratified by the values of a categorical variable, one can use proc sgpanel in sas, or add a facet_grid to a ggplot in r, with similar results. a) true b) false question 13: (2 points) creating plots in r, using the base r function plot(), or ggplot() in the tidyverse can best be described as a method of creating an enhancing graphical displays by adding “layers” of information to the plots. a) true b) false question 14: (2 points: extra credit) (in case someone is superstitious…) if you give two r chucks in r markdown the same name, you will get an error and r markdown will not knit. a) true b) false question 15: (1 point: extra credit) (because, why not?) what is the newest version of r and what is it called? 2 60="" then="" more_than_1hour="0;" the="" sas="" code="" is="" correct="" a)="" true="" b)="" false="" question="" 7="" these="" sub-questions="" relate="" to="" concatenating/appending="" files="" in="" sas.="" 7.1="" (2="" points)="" you="" can="" concatenate="" two="" files="" called="" file1="" and="" file2="" with="" exactly="" the="" same="" variables="" but="" different="" observation,="" using="" the="" set="" command="" in="" the="" data="" step="" as="" follows:="" data="" all;="" set="" file1="" file2;="" run;="" a)="" true="" b)="" false="" 7.2="" (1="" points)="" you="" can="" also="" concatenate="" two="" files="" called="" file1="" and="" file2="" with="" some="" common="" variables="" and="" some="" different="" variables="" and="" different="" observation,="" using="" the="" set="" command="" in="" the="" data="" step="" shown="" in="" 7.1.="" the="" resulting="" file="" will="" have="" missing="" values="" for="" the="" variables="" that="" are="" not="" common="" to="" the="" 2="" files.="" a)="" true="" b)="" false="" 7.3="" (1="" points)="" you="" need="" to="" sort="" the="" datasets="" first="" by="" a="" key="" variable="" (like="" patient_id,="" say)="" in="" order="" to="" concatenate="" files="" in="" sas="" using="" the="" set="" command="" in="" the="" data="" step,="" or="" the="" resulting="" data="" file="" will="" be="" incorrect.="" a)="" true="" b)="" false="" question="" 8:="" (3="" points)="" in="" order="" to="" merge="" 2="" or="" more="" files="" in="" sas="" using="" the="" merge="" command="" in="" the="" data="" step,="" is="" good="" practice="" to="" sort="" them="" first="" by="" the="" variable="" (or="" variables)="" you="" are="" merging="" them="" on="" using="" proc="" sort,="" or="" you="" might="" get="" the="" wrong="" resulting="" file.="" a)="" true="" b)="" false="" question="" 9:="" (2="" points)="" you="" imported="" the="" .csv="" file="" households.csv="" into="" sas="" as="" shown="" below.="" select="" the="" correct="" answer.="" select="" the="" correct="" answer="" a)="" the="" dataset="" you="" created="" is="" called="" households="" and="" it’s="" stored="" in="" the="" library="" final,="" and="" a="" sas="" datafile="" has="" been="" created="" and="" saved="" in="" the="" directory="" c:\users\ybarr\biostat="" 0535="" spring="" 2020\final="" exam="" b)="" the="" dataset="" you="" created="" is="" called="" final.="" c)="" the="" dataset="" you="" created="" is="" called="" households="" and="" it’s="" stored="" in="" the="" library="" work,="" and="" a="" sas="" datafile="" has="" been="" created="" and="" saved="" in="" the="" directory="" c:\users\ybarr\biostat="" 0535="" spring="" 2020\final="" exam="" d)="" the="" dataset="" you="" created="" is="" called="" households="" and="" it’s="" stored="" in="" the="" library="" work,="" but="" no="" sas="" datafile="" has="" yet="" been="" created="" in="" the="" directory="" c:\users\ybarr\biostat="" 0535="" spring="" 2020\final="" exam="" question="" 10:="" (2="" points)="" a="" sas="" date="" is="" a="" value="" that="" represents="" the="" number="" of="" days="" between="" january="" 1,="" 1960,="" and="" a="" specified="" date.="" a)="" true="" b)="" false="" question="" 11:="" (2="" points)="" if="" variables="" in="" a="" data="" frame="" have="" missing="" values="" a)="" ggplot="" will="" ignore="" the="" missing="" values="" and="" produce="" the="" correct="" plot="" without="" the="" missing="" values.="" b)="" the="" code="" will="" not="" work="" at="" all="" and="" it="" will="" produce="" an="" error="" message.="" c)="" na.omit="" will="" have="" to="" be="" included="" in="" the="" data="" section="" of="" ggplot="" listing="" all="" the="" variables="" used="" in="" the="" plot,="" to="" obtain="" the="" desired="" plot.="" d)="" na.omit="" will="" have="" to="" be="" included="" in="" the="" aes="" section="" of="" ggplot="" listing="" all="" the="" variables="" used="" in="" the="" plot,="" to="" obtain="" the="" desired="" plot.="" question="" 12:="" (2="" points)="" to="" create="" side="" by="" side="" plots="" stratified="" by="" the="" values="" of="" a="" categorical="" variable,="" one="" can="" use="" proc="" sgpanel="" in="" sas,="" or="" add="" a="" facet_grid="" to="" a="" ggplot="" in="" r,="" with="" similar="" results.="" a)="" true="" b)="" false="" question="" 13:="" (2="" points)="" creating="" plots="" in="" r,="" using="" the="" base="" r="" function="" plot(),="" or="" ggplot()="" in="" the="" tidyverse="" can="" best="" be="" described="" as="" a="" method="" of="" creating="" an="" enhancing="" graphical="" displays="" by="" adding="" “layers”="" of="" information="" to="" the="" plots.="" a)="" true="" b)="" false="" question="" 14:="" (2="" points:="" extra="" credit)="" (in="" case="" someone="" is="" superstitious…)="" if="" you="" give="" two="" r="" chucks="" in="" r="" markdown="" the="" same="" name,="" you="" will="" get="" an="" error="" and="" r="" markdown="" will="" not="" knit.="" a)="" true="" b)="" false="" question="" 15:="" (1="" point:="" extra="" credit)="" (because,="" why="" not?)="" what="" is="" the="" newest="" version="" of="" r="" and="" what="" is="" it="" called?="">
Answered Same DayMay 10, 2021

Answer To: Question 1: (2 points) You want to describe the data frame “households” using the function...

Medhini answered on May 11 2021
134 Votes
Question 1: (2 points)
You want to describe the data frame “households” using the function describe(households). You have installed the packages shown below, but you get an error when running describe(households)as shown at the bottom of the Console window.
Sele
ct the correct answer
a) You forgot to install the correct package that contains the describe() function, and you don’t have it installed already in RStudio.
b) You misspelled the name of the function.
c) You forgot to call the library(Hmisc).
d) You forgot to call the library(ggplot2).
Answer:- a) You forgot to install the correct package that contains the describe() function, and you don’t have it installed already in RStudio.
Question 2
2.1 (1point) Libraries have the same function in both SAS and R.
a) True        
b) False
Answer:- b) False
2.2 (2 point) Briefly explain your answer.
Answer:- Because in R we have to call the library but in SAS it is in built
Question 3
You read a datafile into R that contains the variables Total_Weightand Total_Fat and you calculate total_lean as follows
total_lean<- total_weight – total_fat
3.1 (1point) The command as written will not work, and the variable total_lean will not be created.
a) True        
b) False
Answer:- a) True
3.2 (1 point) Briefly explain your answer.
Answer:- It is true because in a datafile the variable name is in capital while you writing a code you wrote small letter so it is not working
Question 4: (2 points)
The dataframehouseholds contains a variable called decade_built. It is the decade houses were built, but it’s defined as numeric: col_double(). We want to define it as factor so it can be use it correctly in ggplot().
Select the correct answer on how to obtain a factor variable from the numeric variable decade_built:
a) households$decade_builtnew<- as.factor(households$decade_built)
b) decade_builtnew<- as.factor(decade_built)
c) decade_built cannot be defined as factor
d) households$decade_builtnew<- as.factor(decade_built)
Answer:- a) households$decade_builtnew<- as.factor(households$decade_built)
Question 5: (2 points)
Below is the SAS output of proccontents and a cross tab using procfreq.
    Variables in Creation Order
    #
    Variable
    Type
    Len
    Format
    Label
    1
    subject
    Num
    8
     
    Subject number
    2
    gender
    Char
    8
     
    Gender of subject
    3
    measwt
    Num
    8
     
    Measured Weight
    4
    measht
    Num
    8
     
    Measured Height
    5
    reptwt
    Num
    8
     
    Reported Weight
    6
    reptht
    Num
    8
     
    Reported Height
    7
    female
    Num
    8
    FM.
     
Table of female by gender
female
gender(Gender of...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here