How would you sort the elements of list w in ascending order? ** Answ** w=
sort(w)
What is the code to calculate the correlation between lists a=c(1,2,3,4,5) and
b=c(6,7,8,9,18)? ** Answ** cor(a,b)
What is the code to calculate covariance between the lists A=c(3,4,1,10,6) and
B=c(-8,4,70,2,1)? ** Answ** cov(A,B)
What does length(which(X==4)) return? ** Answ** The indices of the
elements that equal 4
Which of the following statements is an example of a Type II (2) error? **
Answ** A model does not categorize a picture as containing a bicycle, when it
does contain a bicycle.
What would be the null hypothesis in this scenario?
We want to determine if attendance has a significantly positive impact on final
grades for a college course. ** Answ** Students who attend every class do not
receive higher grades than those who do not.
What is the code to find the 6th and 7th elements of the list w? ** Answ**
w[6:7]
, To subtract the standard deviation of list v (created in question 3) from the mean of
list w (created in question 1), you would type:
>mean(w) - SD(V)
Is this correct? ** Answ** No, we need to be more careful as R is case
sensitive.
What does unique(w) return? ** Answ** A list containing all the elements of
w, without repeating them
What is the code to find the 81st percentile of list w (created in question 1). **
Answ** quantile(w, .81)
What is the correct code to get the total elements of w that are less than 10 using 1
line of code? ** Answ** the correct code is length(which(w<10))
What is the correct code to see how many total elements of w equal to 5 using 1
line of code? ** Answ** length(which(w==5))
We would like to know the average fare of taxi trips for different numbers of
passengers.
Which of these R commands will give us this information? ** Answ**
aggregate(Taxi$fare, by=list(Taxi$passengers), mean)
We want to determine if the number of drivers working affects the fuel cost. What
is the correct code to establish a linear regression model for these variables?
Assume the data frame is named "d". ** Answ**
fit1=lm(d$fuelcost~d$driversworking)