Skip to content

Commit

Permalink
updated BW table simuls
Browse files Browse the repository at this point in the history
  • Loading branch information
rajitachandak committed Mar 27, 2024
1 parent 2aec847 commit cdc3b7e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions R/bw_table.R
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Script for generating table 1 in Cattaneo, Chandak, Jansson and Ma (2022)

#parameters
n = 1000
num_sims = 1000
n = 2000
num_sims = 100
y = 0.0
x = 0.0
#true density function
true_dens = stats::dnorm(y, mean = 0, sd=1)

#grid for bandwidth range
h_grid = c(0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5)*0.6
h_grid = c(0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5)*0.5

bw_testing = function(s){
print(s)
Expand Down Expand Up @@ -57,7 +57,7 @@ table_data = table_data[2:nrow(table_data), ]
table_data[, 2] = abs(table_data[,2])
colnames(table_data) = c("BW", "bias", "sd", "rmse", "WBC CE", "RBC CE",
"WBC AL", "RBC AL")
#rownames(table_data) = h_grid/0.6
rownames(table_data) = h_grid/0.5
#print table
table_data
#print(xtable(table_data), file='bw_table.tex')
print(xtable(table_data), file='bw_table.tex')
24 changes: 12 additions & 12 deletions R/bw_table.tex
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
% latex table generated in R 4.1.2 by xtable 1.8-4 package
% Tue Mar 26 14:26:35 2024
% Wed Mar 27 13:55:05 2024
\begin{table}[ht]
\centering
\begin{tabular}{rrrrrrrrr}
\hline
& BW & bias & sd & rmse & WBC CE & RBC CE & WBC AL & RBC AL \\
\hline
0.5 & 0.30 & 0.01 & 0.14 & 0.15 & 100.00 & 100.00 & 0.56 & 1.90 \\
0.6 & 0.36 & 0.01 & 0.08 & 0.10 & 98.00 & 100.00 & 0.32 & 1.08 \\
0.7 & 0.42 & 0.01 & 0.05 & 0.06 & 96.00 & 100.00 & 0.20 & 0.67 \\
0.8 & 0.48 & 0.02 & 0.03 & 0.05 & 89.00 & 99.00 & 0.13 & 0.44 \\
0.9 & 0.54 & 0.02 & 0.02 & 0.04 & 77.00 & 96.00 & 0.10 & 0.32 \\
1 & 0.60 & 0.02 & 0.02 & 0.03 & 70.00 & 94.00 & 0.07 & 0.23 \\
1.1 & 0.66 & 0.03 & 0.01 & 0.04 & 38.00 & 86.00 & 0.05 & 0.18 \\
1.2 & 0.72 & 0.03 & 0.01 & 0.03 & 37.00 & 79.00 & 0.04 & 0.14 \\
1.3 & 0.78 & 0.04 & 0.01 & 0.04 & 13.00 & 74.00 & 0.03 & 0.11 \\
1.4 & 0.84 & 0.04 & 0.01 & 0.04 & 10.00 & 69.00 & 0.03 & 0.09 \\
1.5 & 0.90 & 0.04 & 0.01 & 0.04 & 4.00 & 76.00 & 0.02 & 0.07 \\
0.5 & 0.25 & 0.00 & 0.12 & 0.13 & 100.00 & 100.00 & 0.46 & 1.57 \\
0.6 & 0.30 & 0.01 & 0.07 & 0.08 & 100.00 & 100.00 & 0.27 & 0.90 \\
0.7 & 0.35 & 0.01 & 0.04 & 0.06 & 93.00 & 99.00 & 0.17 & 0.56 \\
0.8 & 0.40 & 0.01 & 0.03 & 0.04 & 89.00 & 99.00 & 0.11 & 0.38 \\
0.9 & 0.45 & 0.01 & 0.02 & 0.03 & 78.00 & 97.00 & 0.08 & 0.27 \\
1 & 0.50 & 0.02 & 0.01 & 0.03 & 64.00 & 95.00 & 0.06 & 0.20 \\
1.1 & 0.55 & 0.02 & 0.01 & 0.03 & 47.00 & 87.00 & 0.04 & 0.15 \\
1.2 & 0.60 & 0.02 & 0.01 & 0.03 & 35.00 & 81.00 & 0.04 & 0.12 \\
1.3 & 0.65 & 0.02 & 0.01 & 0.03 & 34.00 & 70.00 & 0.03 & 0.09 \\
1.4 & 0.70 & 0.03 & 0.01 & 0.03 & 9.00 & 69.00 & 0.02 & 0.07 \\
1.5 & 0.75 & 0.03 & 0.00 & 0.03 & 9.00 & 64.00 & 0.02 & 0.06 \\
\hline
\end{tabular}
\end{table}

0 comments on commit cdc3b7e

Please sign in to comment.