Category Archives: Teaching

ROT cipher generator/cracker in R

The ever-clever Alex (my wife, dontcha know) sent me a sweet message of garbled gibberish letters with “ROT-13” at the end of it. Naturally, I googled. She used a ROT-13 cipher, which is a simple letter substitution cipher.

Of course, I could have just written the alphabet down on a piece of paper, taken two minutes, and read her (very sweet, as it turns out) message, but where’s the fun in that? Instead, I wrote an R function to generate or crack ROT-style ciphers.

To use this, you enter two arguments: the cipher text and then an integer indicating how many letters to the right (positive integer) or left (negative integer) the function should look for the “right” letter.

Example: My name, Darrin Rogers, is “yvmmdi mjbzmn” if I substitute each letter with the one 5 to the “left” of it in the alphabet. That message can be decrypted (after loading the function in R) with this code:

rot.n(“yvmmdi mjbzmn”, 5)

You can further test out the function with this string, each character encoded with the letter 9 positions away from it in the alphabet:

“evmvi xfeer xzmv pfl lg, evmvi xfeer cvk pfl xf”

Here’s the code.

Continue reading

Crazy semester: Completed!

This semester was intense. The Intro to Counseling and Child/Adolescent Psychopathology classes seemed to go well, the internship students generally had good experiences, Dr. Joe McFall and I got some research mostly done, and lots of little mini-dramas of the academic variety happened.

The greatest thing, however, was the White Picket Fence project. Well, the project is great, but the students. A completely great team of undergrads worked really hard on some excellent stuff

  • Exploring, through interviews, LGBTQ+ individuals’ perceptions of “fundamental unknowability” in potential romantic partners
  • Anonymous surveys with experimental manipulations to see the effects of belief in performative bisexuality on judgments of (and possibly tendencies toward) sexual aggression
  • Knowledge of, and attitudes about community resources available for LGBTQ+ victims of intimate partner violence

The projects were presented in three separate venues: The Society for Cross-Cultural Research conference in New Orleans, the SUNY Undergraduate Research Conference, and Fredonia’s own Student Creativity and Research Exposition. They gave great presentations! Note: That’s much easier when the research is great in the first place, which it was.

Eventually I’ll get around to uploading the presentations…

And that’s why you never report point estimates without variability estimates

This piece tells a fascinating story: a farm in Kansas that has had very bad things happening to it for years, all because someone wrote an app that doesn’t report variability estimates when it reports point estimates.

In other words, this mapping app has a hard time figuring out where things are, sometimes–suicidal people, shady businesses, criminals, etc.–and so it reports its best estimate, but doesn’t mention that it is an estimate, and certainly does not report the level of uncertainty.

In other other words: when all it knows is that something is in the US, it tells the user that the thing is right at the center of the US. Reasonable, right? It’s a stats thing: use the center when you don’t know the value. But app users don’t know it’s an estimate, so they show up at a farm in Kansas and make the residents’ lives a living hell.

Point estimates need variability estimates.

Intro to R and a Gambling Demo

I gave a 50-minute presentation at SUNY Fredonia’s Spring 2016 Faculty Professional Development Day. It was a very nice experience. Of course, I prepared way more content than was reasonable for a 50-minute presentation, but I think it went well, anyway. Here is the presentation (PowerPoint; I know all the cool R people use LaTeX for their R presentation slides, but… ).

One thing I did not do in the presentation was a demo I created for simulating 100,000 games of Twenty-One against a dealer, when you have a “hold rule” of 18 or higher, and the dealer has a rule of 17 or higher. It’s over-simplified: Aces always count as 1, and there are only two card draws after the initial deal. However, I think it is at least a little bit fun.

At some point I should go back and add the possibility of Aces being 1 or 11, and also make the output at each step pretty. But for an intro workshop this seemed appropriate, if too long-winded for a 50-minute session. The code is after the break. Continue reading

R for Teaching: Visualize a z-test

I occasionally write functions in R to help me with some aspect of teaching, usually teaching undergrad stats. I always intend to share them with others, but I don’t actually know many other people who use R for teaching. So why not share in blog posts? I’ll start now.

Disclaimer: This functions is untested by anyone but me, it might not work, and I provide no guarantee of accuracy. I mean, I try, but you know…

An R function for visualizing single-sample z-tests, a function I named zvis, produces graphs as below, using (usually) pretty simple options:

zvis(x=104, mu0=100, sigma=15, n=30)

I won’t paste the code here because it’s kind of long, but anyone interested can have it from this link –> zvis. The whole set of arguments can be seen after the break. If, by chance, anyone is interested in this function and wants more explanation of these options, or has suggestions for improving the function, please let me know. Continue reading

Excellent piece about the “commodification” of higher education

In “How college sold its soul to the market”, the estimable eloquently describes my own thoughts about the spiral of higher education toward becoming a servant of financial economies instead of a place where we learn to be thoughtful, analytical, useful citizens in our societies.

This is one of the many  key points for me: “This is not inevitable. It is the result of choices we have made, driven by an ideology that we have allowed to impose itself upon us.”

Because this essay is so awesome, I’m going to post a bunch more quotes I thought were particularly great after the break. Continue reading

Online tools a-go-go: Dokuwiki, Moodle, Limesurvey, and OwnCloud

Lately, I’m all about leveraging the mostly-unused bandwidth, memory, and disk space I pay for from my webhost every month. So I’ve got ownCloud up and running with few problems,  my moodle installation is working nicely, I’ve revived my LimeSurvey installation so I can do class surveys, polls, etc., and–brand new–I’ve got DokuWiki installed and running.

The last one is something I’ve been meaning to do for quite some time. My undergrad stats content has morphed and grown and (I hope) become somewhat refined over a decade or two and half a dozen textbooks. I have thought of typing up some “professor’s notes” for the students, but then a couple of years ago it occurred to me that a wiki would be a great way to maintain that. So that’s what I did. It has very little content right now, that I’m slowly changing that. It might or might not be something like a full set of course notes during this Fall semester. If not, I hope Spring will see a full, robust wiki for the students.

Oh, and speaking of that, OpenIntro has released version 3.0 of their nice, industry-disrupting (OK, not much, but they try) undergraduate statistics textbook. It’s not the most student-friendly text out there (especially for psychology students), but it’s free and it’s accurate.

But I really need to get the wiki content filled out so the students have a second source for the information.