You are on page 1of 4

UNIVERSITY OF ZIMBABWE

BSc Honours in Statistics Level 2 HSTS204

STATISTICAL COMPUTING 2

May/June 2017
Time : 2 hours

Candidates should attempt ALL questions in section A and 2 questions in section B. Marks
will be allocated as indicated.

SECTION A (40 marks)


Candidates may attempt ALL questions being careful to number them A1 to A4.

A1. (a) Give two advantages of LATEX over word processors when typesetting
scientific documents. [2]
(b) Define the preamble making reference to a LATEX document. [2]
(c) Differentiate between an environment and a command in LATEX. [3]

A2. (a) How do you create a field in the EPI INFO form designer? [2]
(b) Describe any 3 types of variables in EPI INFO. [3]
(c) Give any two data formats you can get using EPI INFO export facilility. [2]

A3. (a) Describe the five STATA windows you get when you start up STATA. [5]
(b) Differentiate a do-file and a log-file in STATA. [4]
(c) What commands do you type to change your working directory in R and in
STATA? [2]

A4. (a) (i) Define a data frame in R. [2]


(ii) Explain the terms attaching and detaching a data frame as used in R. [2]
(iii) What is an R script file? [2]
(iv) What is the command you type to execute a script file? [2]
(v) Which are the right-to-left assignment operators in R? [2]
(b) Define the term computer programming. [2]

page 1 of 4
HSTS204

(c) Define the term ‘whitespace’ as used in programming language, and give two
examples of whitespaces in C programming language. [1,2]

SECTION B (60 marks)


Candidates may attempt TWO questions being careful to number them B5 to B7.

B5. (a) Briefly describe the effects of each of the following LATEX
commands/environments;
(i) \noindent
[1]
(ii) \[ \]
[1]
(iii) \vspace{2cm}
[2]
(iv) \begin{verbatim}
\ end{verbatim}
[2]
(v) \begin{equation}\label{Eqn2}
y= X\beta
\end{equation}
[2]
(vi) \title{HSTS204 STATISTICAL COMPUTING 2 EXAMINATION}
\author{FirstAuthor\\SecondAuthor}
\date{June 2017}
\maketitle
[2]
(vii) \begin{center}
\begin{figure}[htbp]
\includegraphics[width=4in]{filename}
\caption{My Graph!}\label{trialgraph}
\end{figure}
\end{center}
[5]
(viii) \begin{tabular}{|l|c|c|c|r|}\hline
&\multicolumn{3}{|c|}{Values}&\\\hline
&1&2&3&\\\cline{2-4}
4&5&6&7&8\\\hline
\end{tabular}
[5]
(b) Give the R commands to input into the workspace memory the matrix A =
 
1 1 2
 0 2 2 
 
 . [5]
 1 0 1 
1 4 1

page 2 of 4
HSTS204

(c) What command would you type in R to save your workspace? [1]
(d) What command would you type in R to save load a package? [1]
(e) What command would you type in R to get summary statistics for all the variables
in a dataframe? [1]
(f) Differentiate between the two R help commands help("keyword") and
help.search("keyword") [2]

B6. (a) Describe the 7 tabs you get when you call the EPI INFO program. [7]
(b) LATEX is an environment where mathematical and statistical formulae can easily
be typed and referenced. Specify the commands that would be used in LATEX
to:
(i) Input the referenced equation

fX,Y (x, y) = 2e−(x+y) I[0,y] (x)I(0,∞) (y) 6.1.1

[3]
(ii) Input an inline equation, ŷi = β̂0 + β̂1 x [3]
(iii) Typing the following characters:
(a) # [1]
(b) ` [2]
(c) \ [2]
(d) ˜ [2]
(c) Explain each of the elements of the standard STATA syntax:
[by varlist:] command [varlist] [=exp] [if exp] [in range]
[weight] [using filename] [,options]
[9]
(d) Which elements are required in a STATA syntax? [1]

B7. (a) Explain the uses of the following STATA syntax:


(i) destring var_name,replace
[2]
(ii) input quesid age sex marital
[3]
(iii) insheet using "C:\myfile.csv", comma
[3]
(iv) infile using "C:\myfile.raw", clear
[3]
(v) infix using "C:\myfile.dcf", clear
[3]

page 3 of 4
HSTS204

(vi) recode age(0/5=1 Under5) (5/14=2 young) (15/24=3 adolescent) ///


,generate(ageg) label(ageg)
[3]
(b) Logical operators are a common feature in STATA programming. Distinguish
between the following pairs of operators:
(i) == and = [2]
(ii) ! and |. [2]
(c) Give 3 examples of computer programming languages. [3]
(d) Briefly describe the environment needed for C programming and explain how this
environment different from the one required for Python programming. [4,2]

END OF EXAMINATION

page 4 of 4

You might also like