FAKULTET FOR NATURVITENSKAP OG TEKNOLOGI FINAL EXAM Exam in: STA-3300 Applied Statistics 2 Date: Wednesday 28. November 2012. Time: 09:00 13:00 Place: Åsgårdvegen 9 Approved aids: Calculator All printed and written The exam consists of 20 pages, front page included. Contact during the exam: Georg Elvebakk Phone: 77646532
IMPORTANT: All points a), b), c) etc. will count for 10% of the final grade. SPSS printouts are listed on pages 5 to 17. There is a norwegian translation (without tables) on pages 19 and 20. If nothing else is specified use 5% significance level on tests, and 95% confidence intervals. Problem 1 We will use data from a study about patients that have had a particular liver operation. We are interested in how long they live after the operation (Y ), and what independent variables that might contribute to predict this survival time. The following data have been recorded for 54 randomly chosen patients. Y Length of survival after operation. (In days, mean around 700.) lny The logarithm of Y. X 1 Index for blod clotting. X 2 A prognostic index. X 3 Enzyme function index. X 4 Liver function index. X 5 Age. X 6 Dummy variable for gender (0 = male, 1 = female). Dummy for high alcohol consumption (0 = not high, 1 = high). X 7 The total data set is given in the SPSS listings. We start by fitting an ordinary regression model for survival time Y with X 4 (liver function index) as the independent variable. We will use this model in points a), b) and c). Use the printouts to answer the questions (model 1 in SPSS). a) In what way is X 4 the best first choice of independent variable in a regression model for Y? Formulate the linear model with X 4 as the independent and Y as dependent variable. Find the fitted (estimated) model and interpret what the estimated parameters tells us in this study. In the next point you might use that S X4 = 1.070. b) Compute S Y X and explain what information this measure gives you about the individual survival times. Find S ˆβ4 (the standard error of the slope of X 4, ˆβ 4 ). Do a test to check whether there is a linear relationship between Y and X 4. Let us say that we get a new patient with a liver function index (X 4 ) of 3.0. You would like to know what can be said about his prognosis from the fitted model with X 4 as independent variable. You can use that X 4 = 2.744 and S X4 = 1.070. c) What is the estimate of the survival time for the patient? Compute a 90% prediction interval for the patient. What kind of information does this interval give the patient? We will now try to make a better model by including some of the other independent variables. We are especially interested in the group of the remaining medical 2
variables, X1, X2 and X3. In the SPSS printouts two models (model 2 and 3) are fitted: Y = β 0 + β 1 X 1 + β 2 X 2 + β 3 X 3 + E Y = β 0 + β 1 X 1 + β 2 X 2 + β 3 X 3 + β 4 X 4 + E d) Explain what these correlations are and compute estimates of them: ρ Y,(X1,X 2,X 3) X 4 and ρ Y,(X1,X 2,X 3) X 4 Do a test to check whether adding the group of X 1, X 2 and X 3 (to a model that includes X 4 ) is contributing to the prediction of Y. We want to choose the best regression model from all the possible independent variables, and have computed some criteria for the most relevant models: Model R 2 MSE C p F p value A X 4 0.454 87793 64.98 11.50 0.00000008 B X 2, X 3 0.523 78293 52.56 10.92 0.0000006 C X 1, X 2, X 3 0.684 52874 20.58 5.15 0.002 D X 1, X 2, X 3, X 4 0.691 52772 21.12 6.38 0.001 E X 1, X 2, X 3, X 5 0.691 52763 21.11 6.37 0.001 F X 1, X 2, X 3, X 7 0.771 39054 4.20 0.732 0.54 G X 1, X 2, X 3, X 4, X 7 0.781 38202 4.18 0.091 0.91 H X 1, X 2, X 3, X 5, X 7 0.774 39438 5.68 0.838 0.44 I X 1, X 2, X 3, X 6, X 7 0.773 39567 5.83 0.916 0.41 J X 1, X 2, X 3, X 4, X 5, X 6, X 7 0.782 39706 8.00 e) Explain very briefly what R 2, MSE, C p and F p measures and how they can be used to choose a best model. Explain which model(s) you would have chosen. In the rest of this problem we will use the model with X 1, X 2, X 3 and X 7. f) Find the fitted model for Y (model 4 in SPSS). Test if X 7 is significantly contributing to the prediction of Y in this model. Explain what a residual is. Are there patterns in the resdidual plot for this model that indicates that some model assumption(s) is/are not OK? Because the data are counting data (number of days patients survive) it is often smart to use a transformation like the logarithm. We will therefore try the same model as above, but with lny as dependent variable instead of Y. The result is in the SPSS printouts (model 5). g) Use model diagnostics techniques to check for outliers, OK model assumptions and collinearity. From this and other information you got, what are your general conclusions about this model? 3
Problem 2 The data in this problem is from an experiment that investigates the factors that might influence how much a car dealer is willing to pay for your car. 18 men and 18 women tried to sell a particual used car to different dealers. They wanted to know if there were any gender difference in how much they were offered. The collected data were as follows (price is in 1000 dollars). Men, Y 1i 21 23 19 22 22 23 30 29 26 28 27 27 25 22 23 21 22 21 Women Y 2i 20 21 19 20 18 24 25 28 26 27 26 28 22 18 19 20 19 19 Y 1i is the amount man number i was offered, Y 2i the amount woman i was offered. We assume men and women are independent. See descriptions in SPSS printouts. a) Formulate a natural model for this experiment. Set up and perform a T-test to find out whether you can claim that men and women are offered different prices from the car dealers. If the test result was negative (no difference detected), how do you conclude regarding the true difference in the price offers men and women receive? But the researchers who deviced the experiment wanted to explore more factors that could influence prices. So the 18 men and 18 women were in fact drawn from three age groups (reffered to as young, middle aged and old ), with 6 in each group. Here is the restructured presentation of the results: Y ijk Young Middle aged Old Gender mean Men 21 30 25 23 29 22 19 26 23 22 28 21 22 27 22 23 27 21 Cell mean: 21.67 27.83 22.33 23.94 Women 20 25 22 21 28 18 19 26 19 20 27 20 18 26 19 24 28 19 Cell mean: 20.33 26.67 19.50 22.17 Age group mean 21.00 27.25 20.92 Total mean: Y = 23.06 The offered price is Y ijk where i = 1, 2 (gender, 1 is male), j = 1, 2, 3 (age group) and k = 1,..., 6. The total mean and the means of each cell, gender, and age group are given. The researchers will use a two-way ANOVA model to analyze the data. b) Do you think these two factors (gender and age) are fixed or random? Formulate a model for this experiment and explain what the elements in the model represent. What would interaction mean in this model. Use the cell means to make a plot that can reveal possible interaction. Conclusion? c) Test the effects of interaction, gender and age groups. Do you get the same result as you got in a)? Can you explain what has happened? Explain how all age groups can be compared by several confidence intervals. Compute the interval for the mean diffference between young and middle aged. How do you conclude from this and the other intervals (from SPSS)? 4
PROBLEM 1 5
6
Model 1: ANOVA b Model Sum of Squares df Mean Square F Sig. 1 Regression 3804272.477 1 3804272.477 Residual 4565248.060 52 87793.232 Total 8369520.537 53 a. Predictors: (Constant), X4 b. Dependent Variable: Y Coefficients a Standardized Unstandardized Coefficients Coefficients Model B Std. Error Beta t Sig. 1 (Constant) 15.191 111.869.136.893 X4 250.305 38.025.674 a. Dependent Variable: Y 7
Model 2: ANOVA b Model Sum of Squares df Mean Square F Sig. 1 Regression 5725819.203 3 1908606.401 36.097.000 a Residual 2643701.335 50 52874.027 Total 8369520.537 53 a. Predictors: (Constant), X3, X2, X1 b. Dependent Variable: Y Coefficients a Standardized Unstandardized Coefficients Coefficients Model B Std. Error Beta t Sig. 1 (Constant) -1410.847 209.118-6.747.000 X1 101.054 20.005.408 5.052.000 X2 9.382 1.876.399 5.000.000 X3 12.128 1.503.649 8.069.000 a. Dependent Variable: Y 8
Model 3: ANOVA b Model Sum of Squares df Mean Square F Sig. 1 Regression 5783681.263 4 1445920.316 27.399.000 a Residual 2585839.274 49 52772.230 Total 8369520.537 53 a. Predictors: (Constant), X4, X2, X3, X1 b. Dependent Variable: Y Coefficients a Standardized Unstandardized Coefficients Coefficients Model B Std. Error Beta t Sig. 1 (Constant) -1279.242 243.808-5.247.000 X1 82.988 26.402.335 3.143.003 X2 8.346 2.120.355 3.937.000 X3 10.870 1.923.581 5.652.000 X4 49.346 47.126.133 1.047.300 a. Dependent Variable: Y 9
Model 4: Model Summary b Model R R Square Adjusted R Square Std. Error of the Estimate 1.878 a.771.753 197.620 a. Predictors: (Constant), X7, X2, X3, X1 b. Dependent Variable: Y ANOVA b Model Sum of Squares df Mean Square F Sig. 1 Regression 6455884.265 4 1613971.066 41.327.000 a Residual 1913636.272 49 39053.801 Total 8369520.537 53 a. Predictors: (Constant), X7, X2, X3, X1 b. Dependent Variable: Y Coefficients a Unstandardized Coefficients Standardized Coefficients Collinearity Statistics Model B Std. Error Beta t Sig. Tolerance VIF 1 (Constant) -1334.424 180.589-7.389.000 X1 81.439 17.781.329 4.580.000.907 1.103 X2 10.131 1.622.431 6.246.000.980 1.020 X3 11.243 1.308.601 8.596.000.954 1.049 X7 312.777 72.341.309.916 1.092 a. Dependent Variable: Y 10
11
Model 5: Model Summary b Model R R Square Adjusted R Square Std. Error of the Estimate 1.911 a.830.816.210820 a. Predictors: (Constant), X7, X2, X3, X1 b. Dependent Variable: LnY ANOVA b Model Sum of Squares df Mean Square F Sig. 1 Regression 10.627 4 2.657 59.774.000 a Residual 2.178 49.044 Total 12.805 53 a. Predictors: (Constant), X7, X2, X3, X1 b. Dependent Variable: LnY Coefficients a Unstandardized Coefficients Standardized Coefficients Collinearity Statistics Model B Std. Error Beta t Sig. Tolerance VIF 1 (Constant) 3.853.193 19.998.000 X1.073.019.239 3.866.000.907 1.103 X2.014.002.488 8.201.000.980 1.020 X3.015.001.668 11.069.000.954 1.049 X7.353.077.282 4.576.000.916 1.092 a. Dependent Variable: LnY 12
Residuals Statistics a Minimum Maximum Mean Std. Deviation N Predicted Value 5.48095 7.49560 6.43054.447777 54 Std. Predicted Value -2.121 2.379.000 1.000 54 Standard Error of Predicted.033.117.060.022 54 Value Adjusted Predicted Value 5.50395 7.45956 6.43269.444607 54 Residual -.453078.593767.000000.202708 54 Std. Residual -2.149 2.816.000.962 54 Stud. Residual -2.244 3.055 -.005 1.016 54 Deleted Residual -.494167.698483 -.002150.227213 54 Stud. Deleted Residual -2.345 3.360.001 1.042 54 Mahal. Distance.286 15.232 3.926 3.634 54 Cook's Distance.000.329.025.053 54 Centered Leverage Value.005.287.074.069 54 a. Dependent Variable: LnY 13
14
15
PROBLEM 2 Group Statistics Gender N Mean Std. Deviation Std. Error Mean Price Men 18 23.94444 3.171050.747424 Women 18 22.16667 3.617767.852716 Tests of Between-Subjects Effects Dependent Variable:Price Type III Sum of Source Squares df Mean Square F Sig. Corrected Model 350.222 a 5 70.044 29.321.000 Intercept 19136.111 1 19136.111 8010.465.000 Gender 28.444 Age 316.722 Gender * Age 5.056 2 2.528 1.058.360 Error 71.667 30 2.389 Total 19558.000 36 Corrected Total 421.889 35 a. R Squared =,830 (Adjusted R Squared =,802) 16
Multiple Comparisons Dependent Variable:Price Mean 95% Confidence Interval (I) Age (J) Age Difference (I- J) Std. Error Sig. Lower Bound Upper Bound Tukey HSD 1.000 2.000 3.000.08333.630990.990-1.47223 1.63889 2.000 1.000 3.000 6.33333 *.630990.000 4.77777 7.88889 3.000 1.000 -.08333.630990.990-1.63889 1.47223 2.000-6.33333 *.630990.000-7.88889-4.77777 Bonferroni 1.000 2.000 3.000.08333.630990 1.000-1.51669 1.68336 2.000 1.000 3.000 6.33333 *.630990.000 4.73331 7.93336 3.000 1.000 -.08333.630990 1.000-1.68336 1.51669 2.000-6.33333 *.630990.000-7.93336-4.73331 Based on observed means. *. The mean difference is significant at the 0,05 level. 17
Norwegian translation: Next two pages. 18
Oppgave 1 Vi skal bruke data fra en studie om pasienter som har gjennomgått en spesiell type leveroperatsjon. Vi er interest i hvor lenge de overlever etter operasjonen (Y ), og hvilke uavhengige variabler som kan bidra til å predikere denne overlevingstida. Følgende data blei registrert for 54 tilfedig valgte pasienter. Y Overlevingstid etter operasjonen. (Dager, gjennomsnitt omkring 700.) lny Logaritmen av Y. X 1 Indeks for blodpropp. X 2 Prognostisk index. X 3 Ensymfunksjonsindeks. X 4 Leverfunksjonsindeks. X 5 Alder. X 6 Dummyvariable for kjønn (0 = mann, 1 = kvinne). Dummy for høgt alkoholforbruk (0 = ikke h øgt, 1 = høgt). X 7 The fullstendige datasettet er er i SPSS-ustskriftene. Vi staret med å tilpasse en vanlig regersjonsmodell for overlevingstid Y med X 4 (leverfunksjonsindeks) som den uavhengige variabelen. Vi vil bruke denne modellen i delpunkta a), b) og c). Bruk utskriftene til å svare på spørsmåla (modell 1 i SPSS). a) På hvilken måte kan en si at X 4 er det beste første valget av en uavhengig variabel i en regresjonsmodell for Y? Formuler en lineær modell med X 4 som den uavhengige og Y som de avhengige variabelen. Finn den tilpassa (estimerte) modellen og gi en fortolking av de estimerte parametrene i denne studien. I dette punktet kan du f å bruk for at S X4 = 1.070. b) Rekn ut S Y X og forklar hva dette målet sier om individuelle overlevingstider. Finn S ˆβ4 (standardfeilen til stigningstallet til X 4, ˆβ 4 ). Utfør en test om det er en lineær sammenheng mellom Y og X 4. La oss si at vi får inn en ny pasient med en leverfunksjonsindeks (X 4 ) på 3.0. Du vil gjerne vite hva som kan sies om vedkommendes diagnose fra modellen med X 4 som den uavhengige variabelen. Du kan bruke at X 4 = 2.744 og S X4 = 1.070. c) Hva blir estimert overlevingtid for pasienten? Rekn ut et 90%-prediksjonsintervall for pasienten. Hva slags informasjon gir dette pasienten? Vi skal nå prøve å lage en bedre modell ved å inkludere noen av de andre uavhengige variablene. Vi er spesielt interessert i gruppa av de gjenværende medisinske variablene, X1, X2 and X3. I SPSS-utskriftene er to modeller (modell 2 og 3) tilpassa: Y = β 0 + β 1 X 1 + β 2 X 2 + β 3 X 3 + E Y = β 0 + β 1 X 1 + β 2 X 2 + β 3 X 3 + β 4 X 4 + E d) Forklar hva disse korrelasjonene måler, og finn estimater av dem: ρ Y,(X1,X 2,X 3) X 4 og ρ Y,(X1,X 2,X 3) X 4 Utfør en test for om variablene X 1, X 2 and X 3 (som ei gruppe) bidrar til å predikere Y (i en modell som inneholder X 4 ). Vi vil gjerne velge den beste regresjonsmodellen fra alle tilgjenglige uavhengige variabler, og har rekna ut disse kriteriene for noen av de mest relevante modellene: 19
e) Forklar svært kort hva R 2, MSE, C p og F p måler og hvordan du kan bruke de til å velge en beste modell. Forklar hvilken modell du ville ha valgt. I resten av denne oppgaven vil vi bruke modellen med X 1, X 2, X 3 og X 7. f) Finn den tilpassa modellen for Y (modell 4 i SPSS). Test om X 7 bidrar signifikant til å predikere Y i denne modellen. Forklar hva et residual er. Er det mønster i residualplottet for denne modellen som indikerer at at en eller fleire av modellforutsetningene ikke er oppfylt?. Fordi dette er telledata (antall dager en pasient overlever) er det ofte lurt å bruke en transformasjon som logaritmen. Vi vil derfor prøve samme modell som over, men bruke lny som avhengig variabel i staden for Y. Resultater i SPSS-utskriftene (modell 5). g) Bruk teknikker for modelldiagnostikk for å sjekke om det finns uteliggere, om modellforutsetningene er oppfylt og om det finns kolinearitet. Fra dette og annen informasjon du har, hva er konklusjonen din om denne modellen? Oppgave 2 Dataene i dette problemet er fra et eksperiment som undersøker hvilke faktorer som kan påvirke hvor mye en bilforhandler er villig til å gi for bilen din. 18 menn og 18 kvinner prøvde å selge en spesiell brukt bil til ulike forhandlere. De ville gjerne vite om det vcar en kjønnsforskjell i hvor mye forhandleren vill tilby. Følgende blei som f,ølge (pris i 1000 dollar): Y 1i er beløpet mann nummer i ble tilbudt, Y 2i er beløpet kvinne nummer i blei tilbudt. Vi antar at menn og kvinner er uavhengige. Se SPSS for meir om dataene. a) Formuler en naturlig modell for dette eksperimentet. Sett opp og utfør en test for om du kan påstå at menn og kvinner tilbys ulike beløp av forhandlerene. Om resultatet av testen var negativ (ingen forskjell funnet), hvordam konkluderer du med hensyn til den sanne forskjellen mellom menn og kvinner. Men forskerne som satte opp eksperimentet ville gjrerne utforske fleire faktorer som kunne påvirke prisene, Derfor var de 18 mennene og 18 kvinnene faktrisk trukket fra tre aldresgrupper (kalt unge, middelaldrende og gamle ), men 6 i hver gruppe. Her er de restrukturerte resultatene: Så tilbudt pris er Y ijk hvor i = 1, 2 (kjønn, 1 er mann), j = 1, 2, 3 (aldersgruppe) og k = 1,..., 6. Det totale gjennomsnittet og gjennomsnitta for hver celle, hvert kjønn og hver aldersgruppe er oppgitt. Forskerne vil bruk en to-vegs ANOVA-modell til å analysere datene. b) Trur du de to faktorene (kjønn og alder) er fikserte eller tilfeldige? Formuler en modell for dette experimentet og forklar hva elementene i modellen representerer. Hva betyr samspill (interaksjon) i denne modellen? Bruk celle-gjennomsnitta til å lage et plott som kan avsløre om det er samspill. Konklusjon? c) Test effektene av samspill, kjønn og alder. Fikk du samm resultat som i a)? Kan du forklare hva som har skjedd? Forklar hvordan alle aldersgruppene kan bli sammenlikna ved fleire konfidensintervall. Rekn ut intervallet for forskjell mellom unge og middeladrende. Konklusjon fra dette og andre intervalal (fra SPSS)? 20