Docsity

Linear Statistical Model: Generating and Plotting Data Points and True Model, Lecture notes of Statistics

Toggle sidebar
bg1
Dynamic Document Example
1. A linear statistical model
Let β0= 2,β1= 1 and assume the followig relation holds true
Y=β0+β1x+,
where x∈[0,10], and ∼N(0, σ2), with σ2= 1.
The following R code generates 100 observations from the statistical model above. Then the data points are
plotted as well as the true linear model.
set.seed(123)
x=seq(0,10,length.out=100)
f=2+x
Y=f+rnorm(100)
plot(x,Y)
abline(2,1,col=2)
0 2 4 6 8 10
2 4 6 8 10 14
x
Y
1

Partial preview of the text

Download Linear Statistical Model: Generating and Plotting Data Points and True Model and more Lecture notes Statistics in PDF only on Docsity!

Dynamic Document Example

1. A linear statistical model

Let β 0 = 2, β 1 = 1 and assume the followig relation holds true

Y = β 0 + β 1 x + ,

where x ∈ [0 , 10], and  ∼ N (0 , σ^2 ), with σ^2 = 1.

The following R code generates 100 observations from the statistical model above. Then the data points are plotted as well as the true linear model.

set.seed (123) x= seq (0,10,length.out=100) f=2+x Y=f+ rnorm (100) plot (x,Y) abline (2,1,col=2)

x

Y