### DATA IMPORT
### Read the data of the 'cake example' into your R-workspace
### These data contains the variables Volume, Firmness and Weight
### for N=1000 pieces of the production. Let these 1000 cakes be
### the production of one day, thus they can be considered the population.
setwd("G:\\tierzucht\\AG_bioinf\\teaching\\Master FPPE\\DataExamples")
library(xlsx)
X = read.xlsx("CakeCharacteristics_V02.xlsx", 1)
dim(X)
head(X)
N = nrow(X)
### SAMPLE FOR QUALITY CONTROL
### Usually, you will not be able to study the whole population.
### Therefore, you want to analyse only a sample of size n.
n = 20
S = sample(1:N, n, replace=FALSE)
Y = X[S,]
### DESCRIPTIVE COMPARISON OF POPULATION AND SAMPLE
### Analyse the data of BOTH, the populatin and of the sample describtively,
### and compare the individual measures of location, of variation and of
### each pairwise correlation.
### Use the R-functions, summary, cov, cor, pairs.
### INFERENTIAL CORRELATION ANALYSIS
### Check whether the data of each variable is normally distribted
### using QQ-plots.
### For each pair of the three variables, test the null hypothesis
### that the correlation is 0.
### Use either Pearson's correlation coefficient R or Kendall's tau.
### You can use the function cor.test
### GRAPHICAL ANALYSIS
### Make pairwise scatterplots of the variables in the populatin.
### Add the coordinated of the sample data using the R-function points.
### Annotate the correlation coefficient into the graph using
### the R-function text