Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Short solutions to the trial exam Exercise 1. a) Paired-samples t-test, as you have two measurements on each individual. Sample size: Want a 95% confidence interval for the difference, that does not include 0 if the difference is 10000 kroner. Use the formula n=1.962*σ2/a2, where a is the maximum distance from the mean to the upper/lower limits of the confidence interval. Need at least 1.96 2 20000 2 n 16 individuals. 10000 2 b) Type I error: Rejecting the null hypothesis when it is true. Type II error: Accepting the null hypothesis when it is false. H0: Mean cost is the same in Norway and Sweden. H1: Mean cost is different in Norway and Sweden. d 0 6812 Test statistic: 2.74 s d / n 11123 / 20 Compare this to the 97.5-percentile of a t-distribution with 19 degrees of freedom. Conclusion: Reject H0 at significance level 5%. Costs are different in Norway and Sweden, and we see that Norway is more expensive. c) The differences have to be normally distributed and independent. The independence assumption is hopefully ok, as these persons are selected at random. The assumption of normality is clearly not valid from the histogram, it has a hump, and is also skewed. d) Sign test. Binomial distribution. Sign test is used since the alternative, a Wilcoxon signed rank test, assumes a symmetric distribution, which is not the case here (it is slightly skewed, otherwise ok with the hump). We don’t reject H0 in this test, since the number of positive and negative differences are about the same (p-value comes from the probability of observing <= 8 negative differences and >=12 negative differences in a binomial distribution with p=0.5 and n=20). The t-test uses the mean difference, and is greatly influenced by the differences of 15000 kroner and above. Exercise 2. a) Cross-sectional study, as they have collected data on the patients currently staying in the wards. Characteristics: See handouts. b) H0: Bgender=0 H1: Bgender=0. There is a significant effect of gender, p-valye 1.7%, and we reject H0. On average, males are 1626 kroner less expensive to treat than females. Constant means: On average, females cost 13267 kroner to treat. Would use two-sample t-test if normality ok, or Mann-Whitney/Wilcoxon test otherwise. c) R is the Pearson correlation. Calculation: See textbook. Predicted cost of a 100 year patient: constant+b*age=1642+170*100=18642 kroner. This would be extrapolation, that is, using the regression model outside the boundaries of your data. There are very few 100-year-olds! The confidence interval for this prediction would be very wide indeed! d) We’re assuming that age has a linear effect on cost, that is, an increase from 30 to 40 year in age has the same effect on costs as an increase from 70 to 80 years. Relationships between two variables can be checked in a scatter plot. If it is non-linear, the standard method is to divide age into groups (say, 10-year intervals), i.e. using it as a categorical variable instead of a continuous variable. e) Have to make dummy variables (0/1 variables) for all categories but one; this will be the reference group. Mean cost of treatment 2: Constant+b*treatment2=147334561=10172 kroner. Here we have three groups. With normality I would use one-way ANOVA. Without normality: Kruskal-Wallis. f) Cost of a 50 year old male using treatment1: 4381-85*1+163*50+0=12446 Cost of a 70 year old female using treatment 3: 4381-85*0+163*70-4059*1=11732 Predicted difference is 714 kroner. The regression estimates have changed because the independent variables are not only correlated to the dependent variable, but also to each other. This is called confounding. g) The histogram of the residuals should have the bell-shape of a normal distribution. It’s not too bad, although slightly skewed to the right. The points in the P-P plot should be on the line. Also not too bad, except for some deviations around 0.8. The scatter plot should look like an irregular cloud, without any patterns. If it is fan-shaped, it could indicate heteroscedasticity (e.g. the higher the values of the dependent variable, the greater the variation in the values). This plot is divided into two equal blobs. I don’t know if that’s very bad, but probably some further examinations are needed. A residual is the distance from a data point (in this case, the data point would be the values of cost, age, gender and treatment for each of the 120 persons) to the fitted regression line. It is used to model unexplained variation in the values of the dependent variable, that is, variation not explained by the independent variables age, gender, treatment. h) Treatment is a confounder of gender, as the regression coefficient for treatment is fairly constant between the univariate and multivariate analyses. Treatment causes the change in the regression coefficient for gender. Females appear more costly in the univariate analyses simply because more of them stay at the urban hospital, where they use the expensive treatment. When both treatment and gender is in the model, you remove the hidden effect of treatment from gender (or, more precisely, you control for the fact that treatment is differently distributed in males and females), and are left with a purer gender effect. Hence, gender in itself does not seem to be important. i) An interaction between gender and treatment would mean e.g. that treatment 1 is more expensive for males than for females. This does not seem reasonable at all. Would the pharma company charge extra for males? Points h) and i) should help to illustrate what confounding and interaction is. We often get the question “What is the difference between confounding and interaction?”. In my opinion, that question is difficult to answer, because it is a bit like asking about the difference between a cucumber and a sheep. Confounding and interaction usually have nothing to do with each other! They are completely unrelated problems! j) Assumptions: See handouts. If there are no group effects, both MSG and MSW are unbiased estimators of the variance/standard deviation in the data. If there are group effects, however, MSG will be biased. Null hypothesis: All group means equal. Reject H0, there are differences, p-value<<0.01. See that the expensive treatment 1 works best (mean effect of 33.19), but the much cheaper treatment 3 is almost equally good (a 2 point difference in the means have no clinical value, as the scale goes from 0 to 50). Treatment 3 is best! Exercise 3. a) P(Cancer)=0.005 P(no cancer)=0.995 P(Test positive|cancer)=0.95 P(test positive|no cancer)=0.015 Bayes’theorem: P( Positive | cancer ) P(cancer ) P(cancer | positive) P( Positive | cancer ) P(cancer ) P( positve | nocancer ) P(nocancer ) 0.95 * 0.005 0.24 24% 0.95 * 0.005 0.015 * 0.995 Similar calculations for prevalence 1/1000 and 1/100 yields 6% and 39%. Hence, probability of cancer given a positive test result is only 24%, even though the test looks good on paper. If the prevalence was 1/1000, only 6% of women with positive tests would have cancer. This does not look to good. A solution could be to take a second test if the first test is positive, and then only treat cases with two positive tests as cancer. b) P(cancer| positive test) was 24%. Means that P(no cancer |positive test)=76%. If you have e.g. 100 positive tests, 24 would be cancers and 76 would be false positives. The cancers would save the Ministry 24*3.000.000=72 million kroner, and the false positives would cost the Ministry 76*1.000.000=76 million kroner. Hence, screening does not seem to be beneficial.