Professional Documents
Culture Documents
Simulation in R: An Introduction
Presented By:
Varun Agiwal
Research Scholar
Department of Statistics
Central University of Rajasthan, Ajmer, Rajasthan
Email:varunagiwal.stats@gmail.com
March 22 , 2018
What is Simulation Need of Simulation Importance Application Necessary Information regarding Simulation
Outline
1 What is Simulation
2 Need of Simulation
3 Importance
4 Application
Methods for generating random numbers
Random Sample Generation in R
Simulation study for properties of estimators
Simulation for properties of hypothesis tests
What is Simulation
Need of Simulation
Importance
Output
2.316056 1.987240 2.006050 2.048347 1.612728 2.214568
1.858669 1.579586 2.005297 1.929183
What is Simulation Need of Simulation Importance Application Necessary Information regarding Simulation
Simulation procedure
s s=1
S 2
1
Θ̂(s) − Θ̂
P
SD Θ̂ = S−1
s=1
S
1 P (s)
absolute bias = (Θ̂ − Θ0 ; mean square error
S
s=1
S 2
1
Θ̂(s) Θ0 =SD 2 + Bias2
P
= S −
s=1
5 Draw conclusion with varying sample size.
What is Simulation Need of Simulation Importance Application Necessary Information regarding Simulation
Solution 2:
What is Simulation Need of Simulation Importance Application Necessary Information regarding Simulation
Output
Solution 3:
What is Simulation Need of Simulation Importance Application Necessary Information regarding Simulation
Output
Table: Estimate value, Average Bias and MSE for intercept coefficient
Sample Size Estimate SD Average Bias MSE
100 0.2011 0.0993 0.0783 0.0099
200 0.1994 0.0712 0.0570 0.0051
300 0.1986 0.0580 0.0463 0.0034
400 0.1992 0.0514 0.0412 0.0026
500 0.2012 0.0444 0.0354 0.0020
Table: Estimate value, Average Bias and MSE for slope coefficient
Sample Size Estimate SD Average Bias MSE
100 0.5027 0.1729 0.1388 0.0299
200 0.4981 0.1193 0.0937 0.0142
300 0.5020 0.1027 0.0820 0.0106
400 0.5013 0.0847 0.0676 0.0072
500 0.4958 0.0782 0.0623 0.0061
What is Simulation Need of Simulation Importance Application Necessary Information regarding Simulation
Conclusion
Simulation procedure
Problem 4:
Generate a sample from normal random variable N(10, 25).
Consider the hypothesis test defined by H0 : µ = 10 against
H1 : µ 6= 10. Evaluate the type I error using 500 simulation at
5% significance level.
What is Simulation Need of Simulation Importance Application Necessary Information regarding Simulation
Conclusion
On the basis of plot, concluded that rejection of the p-value is
more when sample size is small. As sample size increases,
rejection of null hypothesis is decreases at 5 % level of
significance.
What is Simulation Need of Simulation Importance Application Necessary Information regarding Simulation