Pen & Paper

Sci-hub - Research Papers without the Paywalls

29 Feb 2016

Access to research papers behind a paywall is expensive. The cost of Pay-per-view starts at about USD30 and may reach double of this amount for certain publications. Annual subscription fees can run up to millions of dollars for an educational institution. Even Harvard, one of the richest higher education institutions, found the subscription fees unsustainable and openly called for open access. When I was doing my dissertation in one of the less privileged universities which could only afford a very limited list of subscriptions, it was impossible to skim through each and every article that was relevant to my research. Reading only the abstract would perhaps enable me to cite the paper creating the impression that I had read it. It didn’t help my research at all nor did it benefit my learning. To publish behind a paywall seems nonsensical as one of the primary objectives in publishing is to achieve maximum impact by reaching as wide an audience as possible.

Sci-hub to research publications is like Pirate Bay to music. The crucial difference is that Sci-hub steals from publishers such as Elsevier, Wiley, Springer and OUP who have absolutely nothing to do with the research or its findings but Pirate Bay steals from the musicians who create the music. Sci-hub facilitates the creator to reach a wider audience. I do not find it a moral problem to use Sci-hub. It is indispensable to a layperson like myself who is no longer attending schools but still interested in certain research topics.

Rmarkdown for Scientific Papers

14 Mar 2015

  library(knitcitations); library(bibtex); cleanbib()
  cite_options(citation_format = "pandoc", check.entries=FALSE)
  write.bibtex(c(citation("bibtex"), citation("knitr")[1], citation("knitcitations"), 
    citation("xtable"), citation("RefManageR"), citation("rmarkdown")), file="init.bib")
  bib <- read.bibtex("init.bib")
  bib.1 <- read.bibtex("citavi.bib")


This document was created based on a .Rmd template from a blog post by (Keil 2017). The R package “knitr” (Xie 2015) is used to convert the Rmd file to html, pdf or word format. “knitr” has its strengths in reproducible research but it is not designed to produce citations for a scientific paper. The .Rmd template makes use of an xml file for formatting citation styles, “knitcitations” (Boettiger 2017) and “bibtex” (Francois 2017) for generating citations from DOI lookup or bibtex entries.


The template gives examples of writing mathematical equations using $\LaTeX$, formatting R outputs using either knitr::kable (Xie 2015) or “xtable” (Dahl 2016), producing graphic plots using the base “plot” function and generating citations using automatic DOI lookup or “bibtex” (Francois 2017) with knitcitations::citep and knitcitations::citet (Boettiger 2017).


Rmarkdown (Allaire et al. 2017) has full documentation for its syntax. Statistical analysis with plots and tables can be easily created in a .Rmd file by embedding and running “R code chunks” while math equations are produced using $\TeX$ or $\LaTeX$. Rmarkdown (v2) has built-in support for citation as it is based on Pandoc, but it does not have automatic DOI lookup and is better suited to work in conjunction with a citation manager from which bibliography files can be generated and exported for its use.


Inline equations are enclosed by $ with no space following or preceding. A separate paragraph for equations is enclosed by $$ following/preceding with a single space. Sharelatex has detailed documentation for creating mathematical expressions.

The binomial coefficient is defined as

$$ \binom{n}{k} = \frac{n!}{k!(n-k)!} $$
\[ ... \]

$$ \binom{n}{k} = \frac{n!}{k!(n-k)!} $$

These are all Greek α, β, θ0, ε2, η, λ2, μ, τ, σ

In least squares prediction models, we estimate β0, β1, β2, ...βn by minimizing the RSS

\[ RSS=\sum_{i=1}^{n} \Big( y_i - \beta_0 - \sum_{j=1}^{p}\beta_{j}x_{ij}\Big)^2 \]

$$ RSS=\sum_{i=1}^{n} \Big( y_i - \beta_0 - \sum_{j=1}^{p}\beta_{j}x_{ij}\Big)^2 $$


fit <- lm(wage ~ poly(age, 4), data=Wage)
kable(summary(fit)$coef, digits=2, caption="This is a 4th degree polynomial. Coef output knitr::kable")
This is a 4th degree polynomial. Coef output knitr::kable
Estimate Std. Error t value Pr(>|t|)
(Intercept) 111.70 0.73 153.28 0.00
poly(age, 4)1 447.07 39.91 11.20 0.00
poly(age, 4)2 -478.32 39.91 -11.98 0.00
poly(age, 4)3 125.52 39.91 3.14 0.00
poly(age, 4)4 -77.91 39.91 -1.95 0.05


## fit<-lm(Wage$wage~poly(Wage$age,4),data=Wage)
age.grid<-seq(from=agelims[1], to=agelims[2])
preds <- predict(fit, newdata=list(age=age.grid), se=TRUE)
se.bands <- cbind(preds$fit+2*preds$, preds$fit-2*preds$
## par(mfrow=c(1,2), mar=c(4.5,4.5,1,1),oma=c(0,0,4,0))
plot(age, wage, xlim=agelims, cex=.5, col="darkgrey")
title("Degree-4 Polynomial", outer=F)
lines(age.grid, preds$fit, lwd=2, col="blue")
matlines(age.grid, se.bands, lwd=1, col="blue", lty=3)
Fig. 1 - Degree-4 Polynomial. Relationship between Wage and Age (data(Wage) in ILSR. The dotted lines are 95% confidence intervals.
Fig. 1 - Degree-4 Polynomial. Relationship between Wage and Age (data(Wage) in ILSR. The dotted lines are 95% confidence intervals.


In “The Elements of Statistical Learning”, Hastie, Tibshirani, and Friedman (2009) explain with practical examples the application of ridge regression/lasso. The book covers some advanced materials in data mining, inference and prediction. For a less technical treatment of the same subjects, “An Introduction of Statistical Learning” (James et al. 2013) should be a good start.

The two types of citation above are respectively generated by

citet(bib.1[["Hastie.2009"]]) and
citep("DOI 10.1007/978-1-4614-7138-7")

citet and citep may refer to either DOI or a bibtex entry, citet(bib.1[["Hastie.2009"]]) generates Hastie, Tibshirani, and Friedman (2009) where “bib.1”" is a R object created by bib.1<-read.bibtex("name of bibliography file") and “Hastie.2009” is the bibtex entry ID.


Plots, tables, math equations and citations are indispensible elements of any scientific papers. The Rmd template is a quick and convenient way to produce them. The finished Rmd file can then be “knited” to html, pdf or word format for submission in RStudio. To publish this in a jekyll blog, what I did was to knit it to html and include the html file in a post.

Finally, the reference list below is produced by using “bibtex” to write out all citations made in the paper write.bibtex(file="references.bib"). reference.bib and a style file are declared in the front matter.


Allaire, JJ, Joe Cheng, Yihui Xie, Jonathan McPherson, Winston Chang, Jeff Allen, Hadley Wickham, Aron Atkins, Rob Hyndman, and Ruben Arslan. 2017. Rmarkdown: Dynamic Documents for R.

Boettiger, Carl. 2017. Knitcitations: Citations for ’Knitr’ Markdown Files.

Dahl, David B. 2016. Xtable: Export Tables to LaTeX or HTML.

Francois, Romain. 2017. Bibtex: Bibtex Parser.

Hastie, Trevor, Robert Tibshirani, and Jerome Friedman. 2009. The Elements of Statistical Learning. Springer Series in Statistics. Dordrecht: Springer.

James, Gareth, Daniela Witten, Trevor Hastie, and Robert Tibshirani. 2013. An Introduction to Statistical Learning. Springer New York. doi:10.1007/978-1-4614-7138-7.

Keil, Petr. 2017. “» Simple Template for Scientific Manuscripts in R Markdown.” Petr Keil.

Xie, Yihui. 2015. Dynamic Documents with R and Knitr. 2nd ed. Boca Raton, Florida: Chapman; Hall/CRC.

edX - Introduction to Linux

29 Jul 2014

The course is due to start this Saturday. I have signed up. Have you?

Into to Linux
“Into to Linux”

Not sure? Here is the course outline. Still not sure? You may sign up for free or pay $2,400 for a 4-day seminar.

Getting ready for the course? Install Mint Mate. Google “linux distros” will show up many expert opinions about the pros and cons of various distros, but surely, there have to be reasons for Mint to remain consistently on top of the DistroWatch list. After finishing the course, consider perhaps Archlinux to continue the learning process.

Peer Assessment

12 May 2014

Many MOOCs make use of peer assessment as a grading/learning tool. It tends to generate a great deal of complaints as students feel that they have been unfairly graded by their peers. Some complain that the feedback from their peers are of no help at all. This course that I’m taking is no exception. Dissatifaction aplenty after we completed Phase I of a writing project and the peer assessment. One of my colleagues summed up a list of valid reasons why students dislike peer grading.

Peer assessment will never work as a grading tool in a MOOC for the simple reason that participants are not in the same peer group - Carrie is a grad student doing instructional design and I’m learning elementary English. We are not “peers” but we are taking the same course. An entrance examination may partially address the problem. A well designed rubric (contents + weighting) will help. Neither will provide a full remedy. I’m less interested in what the students like or dislike. The question is how to make peer assessment work as an effective grading tool, whether for an online course or not. The reasons listed in Carrie’s original post is equally applicable in a traditional classroom of 12 students.

As a learning tool, peer assessment should work both ways. A student in elementary English will certainly benefit from Carrie’s comment on his/her draft and Carrie can learn how best to guide a student in his/her pursuit.

I believe that assessment is always a critical issue in designing a course. At a more fundamental level, the debate on formative/summative assessment, their merits and demerits is far from being conclusive. Setting our priority may enable an easier decision. I tend to put learning before grading; peer assessment always has its important role to play as its pros outweigh the cons.

What I’d like to see in MOOC and particularly the application of technology in an educational setting is to cater for the needs of 60,000 different “sweet spots”. Enabling the more able students to go further while being careful not to leave behind the rest is already a huge challenge in a traditional classroom of 12. We may be tempted to throw in the towel with a class of 60,000. Technology, however, can make classroom differentiation a reality. Classroom differentiation, in my mind, means 12 lesson plans for 12 students, 60,000 lesson plan for 60,000 students. It is entirely feasible to do so with the help of today’s technology but I have yet to see any evidence of it being implemented, not even a trial implementation.

m a Writer

23 Apr 2014

I just joined a Coursera course in English Composition. The motivation is simple: I want to improve my writing. I like to get an impression of people by reading what they write; it matters more than their voice, their faces or their handshakes as it goes straight to their mind.

My first memorable experience with writing took place over 40 years’ ago - I had a pen-pal in Munich, Germany. Pen-pals may now seem obsolete and irrelevant but back in the days when I was in high school, they were popular among students who were learning English as a second language. My pen-pal and I wrote almost every other week for 3 years telling each other every trivial thing that happened in our lives and exchanging whatever little secrets we had. It was a huge struggle at first and there were times that we misunderstood each other. I didn’t have the vocabulary nor did I know how to properly string the words together without making grammatical mistakes. However, it must have been this desire to express myself clearly to my little friend in Germany that prompted me to work hard on my writing. I started writing more by keepng a diary in English. I studied the lyrics of songs that I was listening to. Many songwriters in my time were excellent story tellers and they tended not to be as colloquial as their contemporary counterparts. I was able to learn from reading something that interested me.

My writing didn’t become error-free after a few years of correspondence with my pen-pal. What benefited me most, perhaps, was the confidence that was instilled in me as a result of the regular practice. As my confidence in using English grew, my writing improved.

I received some valuable lessons in writing in an unlikely place - a construction site where I started as a graduate engineer immediately after finishing my undergraduate degree. It was a mega project that involved countless numbers of contractual disputes, claims and counter-claims, proposals and counter-proposals and design revisions. Part of my duties as a graduate engineer was to draft corresopondence, proposals and claim substantiation for my project manager. The process itself was a great learning experience as I didn’t really know how best to produce a formal proposal or claim substantiation. Even writing a formal contractual letter was something new to me. I believe that 99% of all managers, when they see something they don’t like in a draft, they will just correct it, throw it to the typing pool to get it typed, sign and post it out. Mine didn’t belong to the 99%. He would call me into his office (mostly after working hours) and explained to me why he would make a certain correction. I could either rewrite it or agree to the changes before he would sign it. He did it for things big or small, even a site memo. I still remember the correction he made to my first draft letter which started with “Please be informed …”. He would jokingly tell me that only people in the 19th century would write like that; ‘You may use “We’d like to inform you …” instead or better still skip it altogether and say what you want to say right away’, he said. Sometimes, he would go on and on talking about writing styles, proper referencing in a claim substantiation, when to use or avoid passive and active voice …. A truly incredible construction man whom many may consider a ‘cowboy’.

Think, Say and Do

08 Mar 2013

The article (Ferlazzo, L 2012, “What Skilled Teachers Think, Say and Do”) suggests a classroom management strategy to deal with students who may have disruptive behavior or exhibit resistance to learning. Classroom management is perhaps the most essential teaching skill in a traditional classroom as the more time a teacher has to spend on handling disruptions, the less time he has for teaching. The management techniques mentioned in the article are less relevant in an online learning environment.

The strategy is made up of 8 points, broadly summarizing what a teacher should think, say and do when being challenged by students. The article does not seem to offer anything new, however. The list of items would look particularly familiar to anyone who has had read a book about parenting. It also seems misleading to file the article under the main heading “Students who challenge us” because the article deals only with the general principles of classroom management. These principles are applicable in any classrooms and any learning environment - they do not provide any special insights into the handling students who challenge their teachers.

Let’s examine each of the eight items in turn:

The first point is about being authoritative. True that students will more likely respond to a firm request than to an order. But being firm is not enough. It is important to point out that it has to always go hand in hand with a clear and established disciplinary structure. The effectiveness of an authoritative teacher will greatly diminish if the students do not know of the positive and negative consequences.

Point 2, 3 and 4 are about motivation. The growth mindset was suggested by Carol Dweck as a way to create motivation. It very much expands on Heider’s Attribution theory in social psychology. Giving students choices will encourage them to take responsibility for their own learning. And positive messages are simply positive reinforcement in behavioral management. There is ample evidence in research literature to support the benefits of these motivational practices.

If we use the example given in the article (teacher apologizes for raising his voice), Point 5 is simply a basic aspect of mannerism – it is universally applicable and is not at all specific to “students who challenge us”. However, had the author put this in the context of “Discipline with Dignity”, he would have given this point a far greater significance. The author states that being flexible is “one of the most important things a teacher can do to help students who challenge us”. This seems to imply a different degree of flexibility – one criterion for “students who challenge us” and another for “students who do not challenge us”. Classroom differentiation is often difficult to implement and it always carries a risk of reverse discrimination – the obedient students are paying the price in wasted class time when the disruptive students are getting away with no consequences of their behavior.

A proper learning environment is always important. Research evidence suggests that factors within the school environment have a greater impact on academic and social success than factors outside of school. I’d like to think that a proper learning environment is a basic requirement in education. It will benefit students who want to learn as well as students who resist learning. I fail to see how these so called “life-skill” lessons can be implemented in a typical school setting. Either these lessons form part of the curriculum (which is highly unlikely) or the student must be really lucky to be in a lecture which happens to address his/her problems. I don’t want to sound too negative here but if this last point is read in conjunction with the endnote – it seems to me that it has more to do with marketing than education.

Finally, I believe there are two important points missing in the article. First is reflection. Reflection is especially important in dealing with disruptive students because unless we know the causes of their misbehavior, it is not possible to prescribe a remedy. This, to me, should have been the first thing that a teacher should think. The first thing that a teacher should do is to give an engaging lecture - an obedient student can easily become disruptive in an uninspiring and boring lecture that fails to engage. I believe that 90% of the disruptive students will disappear when a teacher does just this - delivery of an engaging lecture.

I agree with one of the commentators who said that the 8 things are just “common sense” although it could well serve as a useful reminder that a simple act could have a huge impact on the teacher-student relationship. I’m of the opinion that this article provides no particular insights in the handling of students who challenge their teachers. It merely repackages some well- established principles in classroom management under a clever title.

Of Teaching

11 Feb 2013

Teaching is, to many of us, a transfer of knowledge and skills; to others, it is to enable assimilation and accommodation of information for constructing new knowledge. Both are relevant. No matter which theory we believe and whatever teaching strategy we adopt, getting the students to understand what is being taught and enabling them to apply what has been learned must remain the common goals of teaching.

Teaching involves a combination of effort in explaining, instructing, demonstrating and guiding. Theoretical models help an educator design an ideal mix of explanation, instruction, demonstration and guidance. Their optimal proportions, however, depends on the target audience’s stages of cognitive development as well as the subject matter. Too much explanation, the teaching becomes dry and uninteresting; not enough and the students lose sight of the goalpost. Too strict a guideline kills creativity and inhibits discovery; too loose and the students may wander too far off track aimlessly.

The ideal mix is produced not by any theories but by an experienced teacher based on his/her interaction with the class and the students’ feedback. Teaching is perfected by experience. A person is never born an excellent teacher; he/she continues to learn while he/she teaches. Had there been a formula for excellence in teaching, we would have a world full of excellent teachers. We don’t.

Like a student who needs motivation to learn, a teacher must be motivated to teach. Teaching and learning is mutually complementary in the relationship between a teacher and his/her students. Effective learning will only take place in a class that is attentive and enthusiastic to learn; similarly, teaching is effective only when a teacher is eager and passionate to teach. Teaching becomes no more than a transfer of lecture notes from a teacher to his/her students in the absence of motivation.