11.07.2015 Views

statisticalrethinkin..

statisticalrethinkin..

statisticalrethinkin..

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

6.3. AKAIKE INFORMATION CRITERION 193}return( dev.test - dev.train )e first line just announces that sim.train.test is a function, which is a bundle ofreusable code with adjustable inputs. e adjustable input here is N, the sample size. elines of code between the braces are the reusable code. ese lines perform these jobs, inorder:(1) Simulate the training sample, stored in y.train(2) Simulate the test sample, stored in y.test(3) Fit a linear model to the training sample(4) Compute the deviance on the training sample(5) Compute the deviance on the testing sample(6) Report back as output the difference between the test and training devianceOur goal is to repeat this procedure thousands of times, to get a distribution for the differenceD test − D train . R makes this easy:diff

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!