# NOT RUN {
n<-200
rho<-0.4
# Generate the serially correlated error term
noise<-rnorm(n,0,.5)
errors<-c(noise[1],rep(NA,n-1))
for (i in 2:n){
errors[i]<-rho*errors[i-1]+noise[i]
}
# Generate the exogenous and dependent variables
ex1<-rnorm(n,0,1)
ex2<-rnorm(n,1,1)
y <- 4 + 3 * ex1 - 17 * ex2 + errors
sample=data.frame(y,ex1,ex2)
# Estimate
prais.winsten(y ~ ex1 + ex2,data=sample)
# }
Run the code above in your browser using DataLab