#title Simple demonstration stencil for R
#description A very simple little stencil for use in a R context. It has some paragraphs, inline math, equations, as well as execute and text directives
h1 Introduction
Pearson's correlation coefficient when applied to a population is commonly represented by the Greek letter |rho| (rho) and may be referred to as the population correlation coefficient or the population Pearson correlation coefficient. The formula for \(\rho\) is:
\(\rho_{X,Y}= \frac{\operatorname{cov}(X,Y)}{\sigma_X \sigma_Y}\)
h1 Methods
r &cnO0IZ4
x <- 1:100
y <- x + rnorm(length(x),0,10)
cor_est <- cor(x,y)
This stencil creates two variables, |x|, the series of numbers |{1,2...100}| and |y|, which is linearly related to |x| with normally distributed errors,
|y = x + N(0,10)|
h1 Results
The correlation between |x| and |y| was {text round(cor_est,3) 0.951}.
figure ^1
r format png size 16x16cm &csiScir
par(mar=c(4,4,1,1))
plot(x,y,pch=16,cex=2,col=hsv(0,0.9,0.9,0.5))
out
{img [src=out/a-plot-of-csiScir.png] [style=max-width:16cm;max-height:16cm]}
figcaption A plot of |y| versus |x|