
联系我们: 手动添加方式: 微信>添加朋友>企业微信联系人>13262280223 或者 QQ: 1483266981
Understanding Data and Statistical Design (60117)
Assessment Task 2: Data Analysis Assignment
Spring 2022
This assessment task is marked from 60.
It is worth 40% of the marks for this subject.
Please save your file in PDF format with name
60117_Task2_Surname_FirstName
and submit via Canvas.
Due 23:59 Sunday 6th November 2022
You must use R to answer these questions.
Include all R output that you refer to in answering the questions (use the Snipping Tool programme or similar to copy output produced by R).
Make sure you define any variables (other than those already defined) you use in answering these questions.
You must also submit a signed copy of the coversheet with your answers.
?
Q1 & Q2 DATA
The data for Q1 and Q2 is contained in the file “q1q2data.csv”. The variables in this file are summarised in the table below.
Name Type Description
poison experimental factor type of poison (1-3)
therapy experimental factor therapy administered to treat poison (1-4)
time response survival time of animal (10s of hours)
The data records the survival time (variable time) of animals randomly allocated a type of poison (variable poison) and randomly allocated a medical therapy to treat the poison (variable therapy).
To read the data into R, run the getwd() function and save the CSV file in the location returned. Alternatively, use the setwd function to point R to the location where the CSV file is saved. Then run the line of code below.
q1q2.data <- read.csv(“q1q2data.csv”, header=TRUE, colClasses=c(“factor”,”factor”,”numeric”)) QUESTION 1. Observational experiment [14 marks] In this question we assess the survival time (variable time) of animals administered a variety of poisons. The statistical model for the analysis is 〖time〗_n=μ+?_n,n∈{1,2,…,48}, where 〖time〗_n is the survival time of the n-th animal μ is population mean time ?_n is the random effect on time of the n-th animal. ? Construct a histogram of time and superimpose over this a normal density curve fitted to the sample [2 marks]. Citing evidence from the plot, determine if the sample looks to be approximately normally distributed [2 marks]. Using significance level α=0.05, perform a test to determine if population mean time of survival is greater than 4.2 hours. Write down the null and alternative hypotheses [1 mark], the test statistic and associated p-value [1 mark], the test decision (providing a reason for this) [1 mark] and a conclusion using a minimum of mathematical language [1 mark]. From the R output for part (b) you will have noticed the 95% confidence interval 0.42297≤μ<∞. Verify this is correct by performing your own calculation [2 marks]. Using significance level α=0.05, perform a test to determine if population median time of survival is different to 5.3 hours. Write down the null and alternative hypotheses [1 mark], the test statistic and associated p-value [1 mark], the test decision (providing a reason for this) [1 mark] and a conclusion using a minimum of mathematical language [1 mark]. QUESTION 2. Two-factor experiment [16 marks] In this question we continue the analysis from Q1, but this time also considering the factors poison and therapy. Write down the statistical model for a 3×4 factorial experiment that could give rise to the sample data we are considering, excluding interaction between the factors [2 marks]. Identify the experimental units [2 marks]. Using significance level α=0.05, perform two-way ANOVA (without interaction) and document the F-test for the factor poison. Write down the null and alternative hypotheses [1 mark], the test statistic and associated p-value [1 mark], the test decision (providing a reason for this) [1 mark] and a conclusion using a minimum of mathematical language [1 mark]. Using significance level α=0.05, document a normality test on the residuals for the analysis in part (b). Write down the null and alternative hypotheses [1 mark], the test statistic and associated p-value [1 mark], the test decision (providing a reason for this) [1 mark] and a conclusion using a minimum of mathematical language [1 mark]. Using significance level α=0.05, perform Tukey post-hoc analysis on the factor therapy and determine which levels have statistically different means [2 marks]. Using diagnostic plots of the residuals, assess whether the assumptions of independence and constant variance have been met [2 marks]. Q3 & Q4 DATA The data for Q3 and Q4 is contained in the file “q3q4data.csv”. The variables in this file are summarised in the table below. Name Type Description river categorical predictor 0 (Lumber), 1 (Waccamaw) length continuous predictor length of fish (cm) weight continuous predictor weight of fish (g) mercury continuous response mercury concentration (ppm) The data records mercury concentration and attributes of fish caught in two rivers in North Carolina. To read the data into R, run the getwd() function and save the CSV file in the location returned. Alternatively, use the setwd function to point R to the location where the CSV file is saved. Then run the line of code below. q3q4.data <- read.csv(“q3q4data.csv”, header=TRUE, colClasses=c(“factor”,rep(“numeric”,times=3))) QUESTION 3. Simple linear regression [14 marks] In this question we build a simple linear regression to model the relationship between mercury and length. We consider the population model mercury=β_0+β_l*length+? where var(?)=σ^2. Fit the model described above, write down the regression equation [1 mark] and calculate the predicted average mercury level of a fish with length equal to the 0.75 quantile of the sample of length [2 marks]. ? Write down the model’s estimate of σ^2 [2 marks]. Using 0.05 significance level, test whether average mercury level increases by less than 0.065ppm for each additional centimetre of fish length. Write down the null and alternative hypotheses [1 mark], the test statistic [1 mark], the test decision with reason [1 mark] and a conclusion using a minimum of mathematical language [1 mark]. Using appropriate diagnostic plots, determine if the modelling assumptions appear to have been satisfied [3 marks]. Is there any statistical evidence of autocorrelation in the residuals [2 marks]? QUESTION 4. Multiple linear regression [16 marks] In this question we extend the model from Q3 into a multiple linear regression. Create a scatterplot of the variables mercury and weight and colour code the plot according to levels of river [2 marks]. Discuss the need for an interaction term between the predictors river and weight [2 marks]. We now consider the population model mercury=β_0+γ*river1+β_l*length+β_w*weight+δ*river1*weight+? where river1={■(0,&river=0 (Lumber River)@1,&river=1 (Waccamaw River)).┤ Note that R will create the dummy variable river1 automatically. Fit the model described above, write down the regression that applies for the Lumber River [1 mark] and provide interpretations of the estimated coefficients β ?_0 and δ ? [2 marks]. Using 0.05 significance level, determine if the interaction term is significant. Write down the null and alternative hypotheses [1 mark], the test statistic [1 mark], the test decision with reason [1 mark] and a conclusion using a minimum of mathematical language [1 mark]. Calculate the predicted average mercury level for a fish of length 37.9cm and weight 607g caught in the Waccamaw River and the associated 95% two-sided mean confidence interval [2 marks]. You will need to construct a data frame containing this new data point. Below are diagnostic plots of the residuals for the model fitted above. We see that the modelling assumptions have not been satisfied. Sometimes transforming the response variable and fitting a model with the transformed response can result in a model that does satisfy the assumptions. Here we take the response variable mercury to the power of 1/5 and consider the population model 〖mercury〗^(1/5)=β_0+γ*river1+β_l*length+β_w*weight+δ*river1*weight+? where river1={■(0,&river=0 (Lumber River)@1,&river=1 (Waccamaw River)).┤ ? Fit the model described just above, write down the fitted regression equation for the Lumber River [1 mark] and produce diagnostic plots of the residuals [1 mark]. Have the modelling assumptions been satisfied for this model [1 mark]?


发表评论