Professional Documents
Culture Documents
STATISTICAL COMPUTING 2
May/June 2018
Time : 2 hours
A1. (a) What are the three arguments of a document title in LATEX? [3]
(b) Describe any two parameters of a document template in LATEX. [2]
(c) Without using the verbatim environment how else would you type the follow-
ing characters in LATEX:
(i) ` [1]
(ii) ˜ [1]
(iii) \ [1]
(d) Describe how to get opening single and double quotes in LATEX. [2]
(e) What are the effects of the following LATEX commands?
(i) \vspace{2in}.
[2]
(ii) \textsc{}.
[2]
(f) Describe the use and effects of the options [htbp] when inserting
graphics in a LATEX document. [4]
A2. (a) Briefly describe the use of a script in R and outline how to create one
and how to use it. [3]
(b) Differentiate between the two R help commands help("keyword") and
help.search("keyword") [2]
(c) Which are the two right-to-left assignment operators which can be used in
R. [2]
(d) State any three types of R objects. [3]
page 1 of 4
HSTS204
A3. (a) Describe the five STATA windows you get when you start up STATA. [5]
(b) Describe any 4 elements of the general STATA command syntax. [4]
(c) What commands do you type to change your working directory in R
and in STATA? [2]
B4. (a) Describe how data is imported from STATA into R. [2]
(b) Describe how data is imported from Excel into R. [2]
(c) Give the command structure of estimating an ordinary least squares
regression model with an intercept in R. [3]
(d) Give the R command for finding the inverse of a matrix A. [1]
(e) Define a data frame in R. [2]
(f) Explain the terms attaching and dettaching a data frame as used in R. [4]
(g) Differentiate the use of the following environments in typing an
equation in LATEX:
\begin{math}...\end{math},
\begin{equation}...\end{equation},
and
\begin{displaymath}...\end{displaymath}.
[3]
(h) Which is the only required element of a STATA command syntax? [1]
(i) Describe, with the aid of an example, the use of the insheet, infile and infix com-
mands in STATA. [6]
(j) Give the STATA command for producing a scatter plot of variable Y on X1 . [2]
(k) Logical operators are a common feature in STATA programming.
Distinguish between the following pairs of operators:
(i) == and = [2]
(ii) ! and | [2]
B5. (a) Explain the uses of both the do-file and the log-file in STATA. [3,3]
page 2 of 4
HSTS204
(b) Explain, giving an example, any three ways in which the label command may
be used in STATA. [6]
(c) How do you change a string variable containing numbers to numeric in
STATA. [2]
(d) Explain the effects of the following STATA command:
B6. On a fresh page write the output of the following LATEX commands:
(Use A4 bond paper provided)
\documentclass[a4paper 12pt]{article}
\usepackage[centertags]{amsmath}
\title{\begin{Large} UNIVERSITY OF ZIMBABWE \end{Large}}
\author{\underline {BSc Honours in Statistics Level 2} \\
HSTS204 STATISTICAL COMPUTING 2 Practical}
\date{\begin{flushleft}August 2016
\begin{flushright}Time :2 Hours \end{flushright}}
\begin{document}
\maketitle
\begin{enumerate}
page 3 of 4
HSTS204
\item
$
\textbf{S}=\left(\begin{array}{cc}4.46&-3.40\\
-3.40&5.35\\
\end{array}\right)
$
\item \begin{equation}
$$y_{i}\sim f(\alpha;\beta_{i})= \frac{1}{\beta_{i}ˆ
{\alpha}\Gamma(\alpha)}y_{i}ˆ{\alpha-1}eˆ{-\frac{y_{i}
}{\beta_{i}}}$$
\label{est}\end{equation}
\item $\frac{\left(\frac{1-\sqrt{\Lambda}}{\sqrt
{\Lambda}}\right)\left(\sum n_i-g-1\right)}{(g-1)}
\sim F_{2(g-1),2(\sum n_i-g-1)$
\item The table below looks nice.
\begin{footnotesize}
\begin{table}[h]
\begin{tabular}{|r|cccc|cccc|cccc|}\hline
&\multicolumn{12}{|c|}{\Huge Values in appropriate
units}\\\cline{2-13}
Machine&\multicolumn{4}{|c|}{$I$}&\multicolumn{4}
{|c|}{$II$}&\multicolumn{4}{|c|}{$III$}\\\hline
Fibre strength (Y)&36&41&39&42&49&40&48&39&45&
44&35&37\\\hline
Diameter(X)&20&25&24&25&32&22&28&22&30&28&21
&23\\\hline
\end{tabular}
\caption{Machine profiles }
\end{table}
\end{footnotesize}
\end{enumerate}
\end{document}
END OF EXAMINATION
page 4 of 4