Question
Hello could you help the problem below step by step in R please? Data is at the very bottom. The Reliability of Peak Expiratory Flow
Hello could you help the problem below step by step in R please? Data is at the very bottom.
The Reliability of Peak Expiratory Flow Measurement (from Rabe-Hesketh and Skrondal). The peak expiratory flow (PEF), also called peak expiratory flow rate (PEFR) is a person's maximum speed of expiration, as measured with a peak flow meter, a small, hand-held device used to monitor a person's ability to breathe out air. Seventeen subjects were used to assess quality of two instruments for measuring peak-expiratoryflow rate (PEFR). Each of the 17 subjects had four PEFR measurements taken, twice using the standard instrument (wp1, wp2) and twice using a new mini instrument (wm1, wm2). The dataset for this question, pefrlong.txt, is in a long format.
(a) Consider the measurements taken from the new mini instrument only and fit a random intercept model (subject is the random effect).
- i. Write down the mathematical formula for this random intercept model.
- ii. (Before model fitting) Draw the scatter plot of PEFR measurements from wm1 and wm2, use different symbols/colors to differentiate the first measurement and the second measurement. Y-axis is pefr and x-axis is subject id.
- iii. Fit the model and output the result (variance/covariance parameter estimates, solutions for fixed effects, solutions for random effects)
- iv. Estimate and output the predicted pefr values for each subject.
- v. Output the predicted pefr values from fitting a fixed effects model (subject is treated as a fixed effect). Plot the predicted values from (iv) and (v) in one graph (using different symbols/colors to differentiate) to show that the random effects model produces "shrunken" estimates.
(b) Repeat ii and iii for the measurements from the standard instrument.
(c) Comparing the results from a and b, can you conclude which instrument appears better (i.e., more repeatable)?
*Data:
id pefr instrument occasion 1 494 wp 1 1 490 wp 2 1 512 wm 1 1 525 wm 2 2 399 wp 1 2 397 wp 2 2 430 wm 1 2 415 wm 2 3 516 wp 1 3 512 wp 2 3 520 wm 1 3 508 wm 2 4 434 wp 1 4 401 wp 2 4 428 wm 1 4 444 wm 2 5 476 wp 1 5 470 wp 2 5 500 wm 1 5 500 wm 2 6 557 wp 1 6 611 wp 2 6 610 wm 1 6 625 wm 2 7 413 wp 1 7 415 wp 2 7 364 wm 1 7 460 wm 2 8 442 wp 1 8 431 wp 2 8 380 wm 1 8 390 wm 2 9 650 wp 1 9 638 wp 2 9 658 wm 1 9 642 wm 2 10 433 wp 1 10 429 wp 2 10 445 wm 1 10 432 wm 2 11 417 wp 1 11 420 wp 2 11 432 wm 1 11 420 wm 2 12 656 wp 1 12 633 wp 2 12 625 wm 1 12 605 wm 2 13 267 wp 1 13 275 wp 2 13 260 wm 1 13 227 wm 2 14 478 wp 1 14 492 wp 2 14 477 wm 1 14 467 wm 2 15 173 wp 1 15 165 wp 2 15 259 wm 1 15 268 wm 2 16 423 wp 1 16 372 wp 2 16 350 wm 1 16 370 wm 2 17 427 wp 1 17 421 wp 2 17 451 wm 1 17 443 wm 2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started