Docsity

Applied Multivariate Statistics - Homework 1 | STAT 5600, Assignments of Descriptive statistics

Toggle sidebar
bg1
Stat 5600 — Applied Multivariate Statistics
Homework 1
Introduction to R
Due Thursday, January 26
Use R to answer the following questions. Copy your R input and output from
the R console to a word processor or text editor, so that I can see your work. Please
remember to clearly indicate the question numbers and your final answers.
1. Use R as a calculator to compute the following values.
(a) 27(38 −17)
(b) ln(147)
(c) q436
12
2. Create the following vectors.
•a= (5,10,15,20,...,160)
•b= (87,86,85, . . . , 56)
Use vector arithmetic to multiply these two vectors and call the result c. Select
subsets of cto identify the following:
(a) What are the 19th, 20th and 21st elements of c?
(b) What are all of the elements of cwhich are less than 2000?
(c) How many elements of care greater than 6000?
3. Using cfrom the previous problem, use R to compute the mean, median, vari-
ance, and standard deviation of c.
4. Use R to create the following two matrices and do the indicated matrix multi-
plication.
"7 9 12
2 4 13 #×
1 7 12 19
2 8 13 20
3 9 14 21
What is the resulting matrix?
5. The data set RADIOLOGY may be found on the web page. This data set (from
problem 3.5 in your book), contains hospital information for 31 months: visits
to radiology, patient-days, ER visits, and clinic visits. Use read.table to bring
this dataset into R, noting that I have given variable names as the first row.
What are the means and standard deviations of the four data variables (exclud-
ing month)?
6. From the radiology data, construct a scatterplot of clinic visits (x) versus radi-
ology visits (y). Perform the simple linear regression of radiolgy visits on clinic
visits and add the regression line to the plot. Does this fit appear reasonable?

Partial preview of the text

Download Applied Multivariate Statistics - Homework 1 | STAT 5600 and more Assignments Descriptive statistics in PDF only on Docsity!

Stat 5600 — Applied Multivariate Statistics Homework 1 Introduction to R Due Thursday, January 26

Use R to answer the following questions. Copy your R input and output from the R console to a word processor or text editor, so that I can see your work. Please remember to clearly indicate the question numbers and your final answers.

  1. Use R as a calculator to compute the following values.

(a) 27(38 − 17) (b) ln(14^7 ) (c)

√ 436 12

  1. Create the following vectors.
    • a = (5, 10 , 15 , 20 ,... , 160)
    • b = (87, 86 , 85 ,... , 56)

Use vector arithmetic to multiply these two vectors and call the result c. Select subsets of c to identify the following:

(a) What are the 19th, 20th^ and 21st^ elements of c? (b) What are all of the elements of c which are less than 2000? (c) How many elements of c are greater than 6000?

  1. Using c from the previous problem, use R to compute the mean, median, vari- ance, and standard deviation of c.
  2. Use R to create the following two matrices and do the indicated matrix multi- plication. [ 7 9 12 2 4 13

] ×

  

  

What is the resulting matrix?

  1. The data set RADIOLOGY may be found on the web page. This data set (from problem 3.5 in your book), contains hospital information for 31 months: visits to radiology, patient-days, ER visits, and clinic visits. Use read.table to bring this dataset into R, noting that I have given variable names as the first row. What are the means and standard deviations of the four data variables (exclud- ing month)?
  2. From the radiology data, construct a scatterplot of clinic visits (x) versus radi- ology visits (y). Perform the simple linear regression of radiolgy visits on clinic visits and add the regression line to the plot. Does this fit appear reasonable?