Problem 1: Repeated Measurements Data
Simulate a dataset with repeated measurements of Body Weight
and Breed
. The following dataset can be used as a basis:
https://charlotte-ngs.github.io/asmss2022/data/asm_bw_flem.csv
The generated dataset should have the following properties
- For every observation, the ID of the animal, its
Body Weight
and its Breed
should be contained in the dataset.
- Each animal of the given basis dataset should have 5 repeated observations of
Body Weight
and Breed
.
- The phenotypic variance of
Body Weight
within the repeated observations of one animal should be 50% of the total phenotypic variance of Body Weight
determined from the given basis dataset.
Your Tasks
- Analyse the generated dataset with an ANOVA
- Try to see whether you can re-cover the used input data in the results of the analysis
Your Solution
- Read the given basis dataset
- Loop over the records in the basis dataset and add the required number of records
- Analyse the generated dataset with an ANOVA
- Assess the results and compare them with the input used in the simulation
Problem 2: Random Effects Model
Analyse the dataset generated in Problem 1 with a random effects model using the package lme4
. If you had difficulties to solve Problem 1, then you can also use the following dataset.
https://charlotte-ngs.github.io/asmss2022/data/asm_ex08_p01_rep_obs.csv
Your Solution
- Read generated dataset from Problem 1
- Analyse the data using
lme4::lmer()
Latest Changes: 2022-05-06 07:43:31 (pvr)
LS0tCnRpdGxlOiBBcHBsaWVkIFN0YXRpc3RpY2FsIE1ldGhvZHMgLSBOb3RlYm9vayA4CmF1dGhvcjogUGV0ZXIgdm9uIFJvaHIKZGF0ZTogJzIwMjItMDQtMjUnCm91dHB1dDogaHRtbF9ub3RlYm9vawpwYXJhbXM6CiAgZG9jdHlwZToKICAgIGxhYmVsOiBEb2N1bWVudCBUeXBlCiAgICB2YWx1ZTogc29sdXRpb24KICAgIGNob2ljZXM6CiAgICAtIGV4ZXJjaXNlCiAgICAtIHNvbHV0aW9uCiAgICAtIG5vdGVib29rCiAgaXNvbmxpbmU6CiAgICBsYWJlbDogT25saW5lICh5L24pCiAgICB2YWx1ZTogdHJ1ZQogICAgY2hvaWNlczoKICAgIC0gdHJ1ZQogICAgLSBmYWxzZQotLS0KCgoKYGBge3Igc2V0dXAsIGluY2x1ZGU9RkFMU0V9CmtuaXRyOjpvcHR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