## 2012-09-17

### A few words regarding the CFA Level I

Currently, I've been studying for the CFA. While the material, at least for Level I, is not hard to grasp, the sheer breadth of topics is daunting. It seems as though if you put in the time you'll grasp it. The trick is for you to 1) forget your social life, 2) Get comfy with your calculator, 3) Do all EOCs, Blue Boxes, QBank questions over and over again (there is no point only reading...). For the past month and half in which I went through the first reading, I have not been able to enjoy a day out (and I don't see myself relaxing anytime before December). Well, I guess this is what they call delayed gratification.

While I don't intend to inundate you with obscure trivia from the CFAI curriculum, I hope after I sit for the exam in December, I'll have the chance to write a few R scripts for the topics I found interesting like portfolio management, equity, and FI. Till then though, I guess I'll be writing about whatever catches my fancy.

On an aside, It seems this blog is in the nether reaches of the interwebz. So, if you are a human reading this: HELLO!

PS: Some weekend I'll sit down and finish the first series of R posts I intended to do.

## 2012-09-15

### A Useful Function for Sweave Users: Sweatex()

This function is courtesy of AC Davison at EPFL.

Here you go:
options(width=65, digits=7)
options(show.signif.stars=FALSE)
# ps.options(horizontal=FALSE)
set.seed(1234)

Sweatex <- function(filename,extension='Rnw',command='latex',silent=FALSE,preview=TRUE,bibtex=FALSE)
{
#check if latex path is present, otherwise adds it to current path for the GUI
latex.path <- dirname(options('latexcmd')[[1]])
path <- as.character(Sys.getenv("PATH"))
if (regexpr(latex.path,path)==-1) {Sys.putenv("PATH"= paste(path,":",latex.path, sep=""))}

if (command=='latex') command='simpdftex latex --maxpfb'
extension<-paste('.',extension,sep='')
Sweave(paste(filename,extension,sep=''))
if (bibtex)
{  # this does latex+bibtex+latex (if you need latex one more time, uncomment last row)
system(paste(command,' ',filename,sep=''),intern=silent)
system(paste('bibtex',' ',filename,sep=''),intern=silent)
system(paste(command,' ',filename,sep=''),intern=silent)
system(paste(command,' ',filename,sep=''),intern=silent)
}
else system(paste(command,' ',filename,sep=''),intern=silent)
if (preview)
{
system(paste(options('pdfviewer')[[1]],' ',filename,'.pdf',sep=''))
}

}



## 2012-09-14

### QE3 and ESM

Well, this week has been packed with "good" news. I say "good" because we can always see the negative consequences of policy decisions. Yet in this case, I hope the positive out weighs the negative.


%% \Qrating = Automatically create a rating scale with NUM steps, like
%% this: 0--0--0--0--0.
\newcounter{qr}
\newcommand{\Qrating}[1]{\QO\forloop{qr}{1}{\value{qr} < #1}{---\QO}}

%% \Qline = Again, this is very simple. It helps setting the line
%% thickness globally. Used both by direct call and by \Qlines.
\newcommand{\Qline}[1]{\rule{#1}{0.6pt}}

%% \Qlines = Insert NUM lines with width=\linewith. You can change the
%% \vskip value to adjust the spacing.
\newcounter{ql}
\newcommand{\Qlines}[1]{\forloop{ql}{0}{\value{ql}<#1}{\vskip0em\Qline{\linewidth}}}

%% \Qlist = This is an environment very similar to itemize but with
%% \QO in front of each list item. Useful for classical multiple
%% choice. Change leftmargin and topsep accourding to your taste.
\newenvironment{Qlist}{%
\renewcommand{\labelitemi}{\QO}
\begin{itemize}[leftmargin=1.5em,topsep=-.5em]
}{%
\end{itemize}
}

%% \Qtab = A "tabulator simulation". The first argument is the
%% distance from the left margin. The second argument is content which
%% is indented within the current row.
\newlength{\qt}
\newcommand{\Qtab}[2]{
\setlength{\qt}{\linewidth}
\hfill\parbox[t]{\qt}{\raggedright #2}
}

%% \Qitem = Item with automatic numbering. The first optional argument
%% can be used to create sub-items like 2a, 2b, 2c, ... The item
%% number is increased if the first argument is omitted or equals 'a'.
%% You will have to adjust this if you prefer a different numbering
%% scheme. Adjust topsep and leftmargin as needed.
\newcounter{itemnummer}
\newcommand{\Qitem}[2][]{% #1 optional, #2 notwendig
\ifthenelse{\equal{#1}{}}{\stepcounter{itemnummer}}{}
\ifthenelse{\equal{#1}{a}}{\stepcounter{itemnummer}}{}
\begin{enumerate}[topsep=2pt,leftmargin=2.8em]
\item[\textbf{\arabic{itemnummer}#1.}] #2
\end{enumerate}
}

%% \QItem = Like \Qitem but with alternating background color. This
%% might be error prone as I hard-coded some lengths (-5.25pt and
%% -3pt)! I do not yet understand why I need them.
\definecolor{bgodd}{rgb}{0.8,0.8,0.8}
\definecolor{bgeven}{rgb}{0.9,0.9,0.9}
\newcounter{itemoddeven}
\newlength{\gb}
\newcommand{\QItem}[2][]{% #1 optional, #2 notwendig
\setlength{\gb}{\linewidth}
\ifthenelse{\equal{\value{itemoddeven}}{0}}{%
\noindent\colorbox{bgeven}{\hskip-3pt\begin{minipage}{\gb}\Qitem[#1]{#2}\end{minipage}}%
\stepcounter{itemoddeven}%
}{%
\noindent\colorbox{bgodd}{\hskip-3pt\begin{minipage}{\gb}\Qitem[#1]{#2}\end{minipage}}%
\setcounter{itemoddeven}{0}%
}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% End of questionnaire command definitions               %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\begin{center}
\textbf{\huge OTDI Transplant Questionnaire}
\end{center}\vskip1em

\noindent This form is voluntary. You may ignore it, complete parts of it, or
fill it out fully. It is inteded solely for assessing professional opinion with
regard to organ donation in Egypt.
\\
\Qitem{ \Qq{Professional speciality}: \Qline{8cm} }

\Qitem{ \Qq{Age:} \Qline{1.5cm}}
\section*{Questionnaire}

%%\Qitem{ \Qq{Rate your knowledge of the criteria of brain death diagnosis? (i.e.: testing for brain stem reflexes, methods to demonstrate absence of breathing, etc.)}

\Qitem{ \Qq{Rate your knowledge of the criteria of brain death diagnosis. (i.e., testing for brain stem reflexes, methods to demonstrate absence of breathing, etc.)} \\ \Qtab{3cm}{no prior knowledge \Qrating{5} expert knowledge}}
\Qitem{ \Qq{Are you aware of the differences between the diagnosis of brain stem death and whole brain death?} \Qtab{1.5cm}{\QO{} Yes
\hskip0.5cm \QO{} No}}

\Qitem{ \Qq{Do you diagnose brain death in your clinical practice?}
\Qtab{5.5cm}{\QO{} Yes \hskip0.5cm \QO{} No}}

\Qitem{ \Qq{If yes, how many do you diagnose per month?}\hskip0.5cm\Qline{1.5cm}}

\Qitem{ \Qq{Are you aware of current laws regarding organ transplants in Egypt (e.g., 2010:leg.5)?} \Qtab{5.5cm}{\QO{} Yes
\hskip0.5cm \QO{} No}}

\Qitem{ \Qq{Do you think an Egyptian organ transplant system is feasible in the near future?} \Qtab{5.5cm}{\QO{} Yes
\hskip0.5cm \QO{} No}}

\Qitem{ \Qq{In your professional opinion, what is the greatest obstacle for the development of transplant network in Egypt? (Check all that apply)}
\begin{Qlist}
\item Poverty
\item Lack of education
\item Religious beliefs
\item Technical limitations
%  \item Organizational limitations
\item Other: \Qline{4cm}
\end{Qlist}
}

\Qitem{ \Qq{According to your personal religious beliefs, do you support organ donation and transplantation?} \Qtab{2cm}{\QO{} Yes \hskip0.5cm \QO{} No \hskip0.5cm \QO{} I don't know}}

\Qitem{ \Qq{How would you rate your level of interest in working with a transplant team?} \\ \Qtab{3cm}{none \Qrating{5} eager}}

\Qitem{ \Qq{Are you willing to receive tranplant treatment if circumstance warranted?} \Qtab{5.5cm}{\QO{} Yes
\hskip0.5cm \QO{} No}}

\Qitem{ \Qq{How would you rate your attitude towards donating your own organs?}
\\ \Qtab{3cm}{never \Qrating{5} under any circumstances}}

\Qitem{ \Qq{According to your professional opinion, would you advise individuals to include organ donation in their living will?}
\Qtab{5.5cm}{\QO{} Yes \hskip0.5cm \QO{} No}}

\Qitem{ \Qq{In your personal opionion, who would be an ideal candidate for organ donation? (Check all that apply)}
\begin{Qlist}
\item Live Donor
\item Brain dead individual on supportive treatment
\item Other: \Qline{4cm}
\end{Qlist}
}

If you are interested in receiving updates in the future regarding OTDI's campaign, please fill the form below: \\
\\
\bf{Name:}  \Qline{5.5cm}} \\
\bf{Phone:} \Qline{5.5cm}} \\
\bf{Email:} \Qline{5.5cm}}
\newpage

%\textit{Organ Transplant and Donation Initiative (OTDI) is a non-profit startup aimed at building scientific and community dialog in Egypt. Started by a group of young physicians and professionals who are keen on building both policy and technical infrastructure needed for a broad ranged transplant network in Egypt, OTDI's mission is to provide a continuous initiative towards the advocacy of organ transplantation and donation; aimed at both increasing the awareness of the general public and offering up to date scientific opportunities for those involved in the field.}
%Organ Transplant and Donation Initiative (OTDI) is a non-profit startup aimed at building scientific and community dialog in Egypt. Started by a group of young physicians and professionals who are keen on building both policy and technical infrastructure needed for a broad ranged transplant network in Egypt, OTDI's mission is to provide a continuous initiative towards the advocacy of organ transplantation and donation; aimed at both increasing the awareness of the general public and offering up to date scientific opportunities for those involved in the field.
\minisec{What is OTDI?}
\textit{Started by a group of young physicians and professionals, the Organ
Transplantation and Donation Initiative (OTDI) is a non-profit initiative
transplantation in Egypt.}
\minisec{Our Vision}
\textit{Save the lives of thousands of Egyptians through organ donation and transplantation.}
\minisec{Our Mission}
\textit{Provide a continuous initiative towards the advocacy of organ transplantation
and donation; aiming at both increasing the awareness of the general public and
offering up to date scientific opportunities for those involved in the field.}
\minisec{Our Goals}
\begin{itemize}\itemsep-1pt
\item{\textit{\textbf{Advocate for organ donation and the new transplant law}}}
\item{\textit{\textbf{Combat the stigma accompanying this controversial issue}}}
\item{\textit{\textbf{Provide opportunities for interns and residents in the transplant field}}}
\item{\textit{\textbf{Raise funds for the cause}}}
\item{\textit{\textbf{Set up a sustainable system that will continue serving the cause}}}
\end{itemize}