-
Notifications
You must be signed in to change notification settings - Fork 0
/
Analysis-Script.html
524 lines (461 loc) · 21.4 KB
/
Analysis-Script.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />
<title>Analysis Scripts</title>
<script src="libs/jquery-1.11.3/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="libs/bootstrap-3.3.5/css/flatly.min.css" rel="stylesheet" />
<script src="libs/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script src="libs/bootstrap-3.3.5/shim/html5shiv.min.js"></script>
<script src="libs/bootstrap-3.3.5/shim/respond.min.js"></script>
<script src="libs/navigation-1.1/tabsets.js"></script>
<meta name="robots" content="index, follow">
<link rel="stylesheet" href="./include/protection-assessment-toolkit.css" />
<script type="text/javascript" src="./libs/zeroclipboard-2.2.0/ZeroClipboard.js"></script>
<link rel="stylesheet" href="./libs/colorbox-1.6.1/colorbox.css" />
<script type="text/javascript" src="./libs/colorbox-1.6.1/jquery.colorbox-min.js"></script>
<!--- favicon --->
<link rel="apple-touch-icon" sizes="57x57" href="./images/favicon/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="./images/favicon/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="./images/favicon/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="./images/favicon/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="./images/favicon/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="./images/favicon/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="./images/favicon/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="./images/favicon/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="./images/favicon/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="./images/favicon/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="./images/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="./images/favicon/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="./images/favicon/favicon-16x16.png">
<link rel="manifest" href="./images/favicon/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="./images/favicon/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<style type="text/css">
h1 {
font-size: 34px;
}
h1.title {
font-size: 38px;
}
h2 {
font-size: 30px;
}
h3 {
font-size: 24px;
}
h4 {
font-size: 18px;
}
h5 {
font-size: 16px;
}
h6 {
font-size: 12px;
}
.table th:not([align]) {
text-align: left;
}
</style>
</head>
<body>
<style type = "text/css">
.main-container {
max-width: 940px;
margin-left: auto;
margin-right: auto;
}
code {
color: inherit;
background-color: rgba(0, 0, 0, 0.04);
}
img {
max-width:100%;
height: auto;
}
.tabbed-pane {
padding-top: 12px;
}
button.code-folding-btn:focus {
outline: none;
}
</style>
<div class="container-fluid main-container">
<!-- tabsets -->
<script>
$(document).ready(function () {
window.buildTabsets("TOC");
});
</script>
<!-- code folding -->
<nav>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">The "Technical" Protection Assessment Toolkit</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="design" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Design <span class="caret"></span></a>
<ul class="dropdown-menu multi-column columns-3" role="menu" id="menu_design">
<div class="row">
<div class="col-sm-4">
<ul class="multi-column-dropdown">
<li class="dropdown-header">Planning</li>
<li><a href="Assessment-Project-Document.html">Assessment Project Document</a></li>
<li><a href="Memorandum-of-Understanding.html">Memorandum of Understanding</a></li>
<li><a href="Terms-of-Reference-for-Assessment-Focal-Point.html">Terms of Reference for Assessment Focal Point</a></li>
</ul>
</div>
<div class="col-sm-4">
<ul class="multi-column-dropdown">
<li class="dropdown-header">Methodology</li>
<li><a href="Sampling.html">Sampling</a></li>
<li><a href="Interview.html">Interview approach</a></li>
<li><a href="Pre-Assessment.html">Pre-Assessment</a></li>
</ul>
</div>
<div class="col-sm-4">
<ul class="multi-column-dropdown">
<li class="dropdown-header">Form</li>
<li ><a href="protection-Topics.html">Protection Topics</a></li>
<li ><a href="Module-questions.html">Questions Modules</a></li>
<li ><a href="Guidelines-for-Customisation.html">Guidelines for Customisation</a></li>
</ul>
</div>
</div>
</ul>
</li>
<li class="dropdown">
<a href="collect" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Collect <span class="caret"></span></a>
<ul class="dropdown-menu multi-column columns-3" role="menu" id="menu_collect">
<div class="row">
<div class="col-sm-4">
<ul class="multi-column-dropdown">
<li class="dropdown-header">Preparing for fieldwork</li>
<li><a href="Fieldwork-Training-Agenda.html">Fieldwork Training and Agenda</a></li>
<li><a href="Pre-test-Phase.html">Pre-test Phase</a></li>
<li><a href="Managing-Devices.html">Managing Devices</a></li>
</ul>
</div>
<div class="col-sm-4">
<ul class="multi-column-dropdown">
<li class="dropdown-header">Fieldwork manual</li>
<li ><a href="Instructions-for-Interviewers.html">Instructions for Interviewers</a></li>
<li ><a href="Instructions-for-Supervisors-Editors.html">Instructions for Supervisors and Editors</a></li>
<li ><a href="Instructions-for-Managers.html">Instructions for Managers</a></li>
</ul>
</div>
<div class="col-sm-4">
<ul class="multi-column-dropdown">
<li class="dropdown-header">Using KoboToolBox</li>
<li ><a href="Data-Protection-Impact-Assessment.html">Data Protection Impact Assessment</a></li>
<li ><a href="Server-Configuration.html">Server Configuration</a></li>
<li ><a href="Data-Entry.html">Data Entry</a></li>
</ul>
</div>
</div>
</ul>
</li>
<li class="dropdown">
<a href="analyse" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Analyse <span class="caret"></span></a>
<ul class="dropdown-menu multi-column columns-3" role="menu" id="menu_analyse">
<div class="row">
<div class="col-sm-4">
<ul class="multi-column-dropdown">
<li class="dropdown-header">Analysis Steps</li>
<li ><a href="Discover.html">Discover</a></li>
<li ><a href="Predict.html">Predict</a></li>
<li ><a href="Advise.html">Advise</a></li>
</ul>
</div>
<div class="col-sm-4">
<ul class="multi-column-dropdown">
<li class="dropdown-header">Report</li>
<li ><a href="Analysis-Script.html">Analysis Scripts</a></li>
<li ><a href="Model-for-Key-Findings-Report.html">Model for Key Findings Report</a></li>
<li ><a href="Model-for-Final-Report.html">Model for Final Report</a></li>
</ul>
</div>
<div class="col-sm-4">
<ul class="multi-column-dropdown">
<li class="dropdown-header">Communication</li>
<li><a href="Slides-Infographics.html">Slides & Infographics</a></li>
<li><a href="Microdata.html">Sharing microdata for social scientist</a></li>
</ul>
</div>
</div>
</ul>
</li>
<li><a href="protection-assessment-toolkit.pdf">PDF</a></li>
</ul>
<form id="rechercher" class="navbar-form navbar-right" role="search" style="padding-top: 5px;" method="get" action="https://tontonroger.org/">
<div class="form-group">
<input name="q" type="text" class="form-control input-sm" placeholder="Search">
</div>
<button type="submit" class="btn btn-default btn-sm" name="Search">
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
</button>
</form>
</div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
</nav>
<div class="row">
<div class="col-sm-9" role="main">
<article>
<div class="fluid-row" id="header">
<h1 class="title toc-ignore">Analysis Scripts</h1>
</div>
<div id="TOC">
<ul>
<li><a href="#defining-script-for-analysis-automation">Defining Script for Analysis automation</a><ul>
<li><a href="#categorical-variables-having-several-code-options">Categorical variables having several code options:</a></li>
<li><a href="#confidence-intervals">Confidence intervals:</a></li>
<li><a href="#rounding-decimal-points">Rounding decimal points:</a></li>
<li><a href="#decimal-points-in-the-results">Decimal points in the results:</a></li>
<li><a href="#missing-data-or-consent-not-provided">Missing data or consent not provided:</a></li>
<li><a href="#always-clean-the-data-first-before-going-into-analysis">Always clean the data first before going into analysis:</a></li>
<li><a href="#age-variable">Age variable:</a></li>
<li><a href="#reproducible-analysis">Reproducible Analysis</a></li>
</ul></li>
</ul>
</div>
<div class="note">
<p><strong>Key Take Away</strong> :</p>
</div>
<div id="defining-script-for-analysis-automation" class="section level2">
<h2>Defining Script for Analysis automation</h2>
<p>Using the right combination of packages fromt he R statistical language, it is possible to integrate all necessary data analysis steps into <strong>scripts</strong>:</p>
<ul>
<li><p>Data management (clean, recode, merge, reshape)</p></li>
<li><p>Data analysis (test, regression, multivariate analysis, etc…)</p></li>
<li><p>Data visualisation (plot, map, graph…)</p></li>
<li><p>Writing up results (report and presentation generation)</p></li>
</ul>
<div class="figure">
<img src="images/analysis.png" />
</div>
<p>This allow for <a href="http://edouard-legoupil.github.io/humanitaRian-data-science/slides/">reproducible data analysis workflow</a></p>
<div id="categorical-variables-having-several-code-options" class="section level3">
<h3>Categorical variables having several code options:</h3>
<ul>
<li>In the data cleaning process, make sure that the codes are the same as those on the standard questionnaire. E.g. vitamin A should be coded 1-3 in the questionnaire but code ‘4’ may appear in the database. This code ‘4’ needs to be excluded from analysis and not included in the denominator as it was a mistake in data recording on the field.</li>
</ul>
<p>Code ‘8 or ‘98’ for ‘don’t know’:</p>
<ul>
<li>Make sure to exclude codes ‘8’, ‘98’ or ‘998’ for ‘don’t know’ from the analysis. This should not be part of the denominator in the calculation of indicators (e.g. diarrhoea, IYCF, ANC enrolment).</li>
</ul>
<p>Code ‘6’ or ‘96’ for ‘other’:</p>
<ul>
<li>Make sure to include codes ‘6’ or ‘96’ for ‘other’ in the analysis. This should be part of the denominator in the calculation of indicators as it represents one response option (e.g. safe disposal of U3 stool, reason for not having a ration card, source of water).</li>
</ul>
<p>Recoding with the ‘if’ command in Epi Info software:</p>
<ul>
<li>Do not forget to take into account missing values when using the ‘if’ command. This applies to many different variables. Whenever feasible, it is much better to use the ‘recode’ command instead of the ‘if’ command for this specific reason.</li>
</ul>
</div>
<div id="confidence-intervals" class="section level3">
<h3>Confidence intervals:</h3>
<ul>
<li>Different software often calculate confidence intervals as being negative and hence below zero or above 100. Negative confidence intervals or CI above 100 are meaningless. In the report, always round negative confidence intervals to ‘0’ and round those above 100 to ‘100’.</li>
</ul>
</div>
<div id="rounding-decimal-points" class="section level3">
<h3>Rounding decimal points:</h3>
<ul>
<li>Make sure to round properly decimal points according to basic rules:</li>
<li>When decimal is between 1-4, round down.</li>
<li>When decimal is between 5-9, round up.</li>
</ul>
</div>
<div id="decimal-points-in-the-results" class="section level3">
<h3>Decimal points in the results:</h3>
<ul>
<li>When the results is a whole number e.g. 30%, make sure to always write 30.0% with the ‘.0’ in the decimal place in the report. This ensures that the decimal point was not forgotten and is actually equal to zero.</li>
</ul>
</div>
<div id="missing-data-or-consent-not-provided" class="section level3">
<h3>Missing data or consent not provided:</h3>
<ul>
<li>Data should be excluded from all analysis and should not be accounted for in the denominator.</li>
</ul>
</div>
<div id="always-clean-the-data-first-before-going-into-analysis" class="section level3">
<h3>Always clean the data first before going into analysis:</h3>
<ul>
<li>Frequencies and means should be run on categorical and continuous variables, respectively.</li>
<li>Missing data should be looked at and a record of them should be kept.</li>
</ul>
</div>
<div id="age-variable" class="section level3">
<h3>Age variable:</h3>
<ul>
<li>When selecting age or creating an age variable category in Epi info software from the ‘months’ variable generated by ENA, don’t forget the ‘.99’ otherwise some children with an exact birth date may be excluded from the analysis. E.g. 6-23.99 (and not 6-23 or 6-23.9).</li>
</ul>
</div>
<div id="reproducible-analysis" class="section level3">
<h3>Reproducible Analysis</h3>
<p>Always save newly generated variables into a new data file named following a naming convention to be respected by all involved in the survey data analysis.</p>
</div>
</div>
</article>
</div>
<div class="col-sm-3" role="complementary">
<nav class="hidden-print hidden-xs" id="nav_sidebar">
</nav>
</div>
</div>
<script>
// manage active state of menu based on current page
$(document).ready(function () {
// active menu
href = window.location.pathname;
href = href.substr(href.lastIndexOf('/') + 1);
if (href=='') href = 'index.html';
$('a[href="' + href + '"]').parent().addClass('active');
$('a[href="' + href + '"]').parent().parents('li').addClass('active');
// élargir la page d'accueil
if (href=='index.html') $('.col-sm-9').attr('class','col-sm-12');
// rechercher
$("#rechercher").submit(function(event) {
$('input[name="q"]').val($('input[name="q"]').val() + ' site:unhcr-mena.github.io/protection-assessment-toolkit');
});
// sidebar
$("#nav_sidebar").append($("#TOC").html());
$("#nav_sidebar ul").addClass("nav nav-stacked");
$("#TOC").addClass("visible-xs-block");
$('body').scrollspy({
target: '#nav_sidebar',
offset: 40
});
// Identifier les <pre> fermant
$('pre').next("*:not(pre)").prev().addClass('last'); // Dernier <pre> de chaque groupe contigu de <pre>
$('pre').parent().each(function (){
$(this).children('pre').last().addClass('last');
}); // Si <pre> est le dernier enfant de son parent
// Ajout liens rdocumentation et tooltip
$("code[data-pkg]").each(function( index ) {
pkg = $(this).attr('data-pkg');
if ($(this).attr('data-rdoc') !== undefined) {
rdocumentation = $(this).attr('data-rdoc');
} else {
rdocumentation = $(this).text();
}
fonction = $(this).text();
$(this).wrap('<a href="http://www.rdocumentation.org/packages/'+pkg+'/functions/'+rdocumentation+'">');
$(this).attr('data-toggle','tooltip');
$(this).attr('data-placement','top');
$(this).attr('title','package : ' + pkg);
$('[data-toggle="tooltip"]').tooltip();
});
$("code.pkg").each(function( index ) {
$(this).wrap('<a href="http://www.rdocumentation.org/packages/'+$(this).text()+'">');
});
// Figures
$("figure").each(function( index ) {
if ($(this).children("figcaption").length > 0)
$(this).children("figcaption:first").prepend('<span class="figure-number">Figure '+(index+1)+'.</span> ');
else
$(this).append($("<figcaption>").append('<span class="figure-number">Figure '+(index+1)+'</span>'));
});
// Colorbox
jQuery('article div img').colorbox({
maxWidth: '90%',
maxHeight: '90%',
rel: 'figures',
current: "",
href: function(){
return $(this).attr('src');
},
title: function(){
return $(this).attr('alt');
}
});
jQuery('article div img').css('cursor', 'pointer');
jQuery('figure img').colorbox({
maxWidth: '90%',
maxHeight: '90%',
rel: 'figures',
current: "",
href: function(){
return $(this).attr('src');
},
title: function(){
return $(this).parent().children("figcaption").text();
}
});
jQuery('figure img').css('cursor', 'pointer');
// ZeroClipboard
$('pre.r').parent().each(function(){
$(this).children('pre.r').first().before('<div class="zero-clipboard hidden-print hidden-xs"><button class="btn-clipboard">Copy</button></div>');
}); // Il peut arriver que le pre ne soit pas précédé (cf. figures)
$('*:not(pre):not(.zero-clipboard) + pre.r').before('<div class="zero-clipboard hidden-print hidden-xs"><button class="btn-clipboard">Copy</button></div>');
$('pre.last').after(function() {
if ($(this).hasClass("r")) res = $(this).text(); else res = "";
$(this).prevUntil('*:not(pre)','pre.r').each(function() {
res = $(this).text() + '\n' + res;
});
return '<div class="clipboard">' + res + '</div>';
});
$('.zero-clipboard').each(function(index){
$(this).children('.btn-clipboard').attr('data-clipboard-target','clipboard_'+index);
$(this).nextAll("div.clipboard").first().attr('id','clipboard_'+index);
});
var client = new ZeroClipboard( $(".btn-clipboard") );
client.on( "ready", function( readyEvent ) {
// alert( "ZeroClipboard SWF is ready!" );
client.on( "aftercopy", function( event ) {
// `this` === `client`
// `event.target` === the element that was clicked
//event.target.style.display = "none";
$(event.target).parent().before('<div class="alert alert-success"><a href="#" class="close" data-dismiss="alert">×</a>The <strong>R</strong> code is now copied in your clipboard.</div>');
} );
} );
});
</script>
<!-- disqus -->
<div class="row">
<div id="disqus_thread" class="col-sm-9" role="complementary"></div>
</div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'protection-assessment-toolkit'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Activate JavaScript to see <a href="http://disqus.com/?ref_noscript">Disqus Comments.</a></noscript>
<!--<a href="http://disqus.com" class="dsq-brlink">Comments are hosted by <span class="logo-disqus">Disqus</span>.</a>-->
<footer>
<div class="row">
<div class="col-lg-12">
<p>Powered by <a href="http://www.r-project.org/" rel="nofollow">R</a>, </a><a href="http://www.rstudio.com/" rel="nofollow">RStudio</a>, <a href="http://rmarkdown.rstudio.com/" rel="nofollow">R Markdown</a>, <a href="http://yihui.name/knitr/" rel="nofollow">knitr</a>, <a href="http://pandoc.org/" rel="nofollow">pandoc</a> and <a href="http://www.princexml.com/" rel="nofollow">Prince XML</a>. Hosted by <a href="https://github.com/" rel="nofollow">GitHub</a>.</p>
</div>
</div>
</footer>
</div>
<script>
// add bootstrap table styles to pandoc tables
function bootstrapStylePandocTables() {
$('tr.header').parent('thead').parent('table').addClass('table table-condensed');
}
$(document).ready(function () {
bootstrapStylePandocTables();
});
</script>
</body>
</html>