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 ROT cipher generator/cracker in R

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…

So this just happened

Today it snowed somewhat heavily. The parking lot was a mess. I found a spot, though that put me less than a foot from cars on either side of me (you know how it goes in snowy parking lots). I’m assuming that’s what this is about. I got back to my car after a day of teaching and found a bag of garbage stuffed under my windshield wiper with a note stuffed into it.

I guess I can take comfort in knowing that at least this student can spell these basic words (good job, anonymous SUNY Fredonia student!). On the other hand, what if I actually were African American? I probably wouldn’t be so calm about this. I don’t think the person saw me at all, given the snowstorm while I was parking, but who knows?

This doesn’t seem like the kind of thing to report to the police, but it’s disconcerting knowing that a student who thinks this is OK is enrolled in my school.

So brave.
Penmanship demonstration #1

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.

Free Will is Bad for (the Study of) Psychopathology?

I clicked the title of this piece, despite it being in Psychology Today, which doesn’t always report as scientifically as I would like. Because I am interested in thinking and research about “free will.” I expected another piece saying what most of them say, but did not expect the very insightful discussion of how a belief in free will might play into mental illness–how we conceptualize it, how we study it, how we talk about it, and how individuals experience it.

Kudos to Stankevicius, for exploring a rarely-considered but perhaps very important implication of the “do we have free will?” issue.

Notes to students:

  1. This is written by a psychiatrist (i.e., an MD), not a psychologist. You might see a different style of thinking, and you will definitely see some psychiatry-specific terminology.
  2. Read the article at your own risk. The philosophical and scientific question of whether we have “free will” is a very deep rabbit hole. You don’t necessarily come out feeling comfortable.

Mexico is ridiculously ethnically diverse

It’s nearly criminal that the US knows so little about Mexico. Since living there 20+ years ago I’ve thought about it a lot, including about how weird it is that Native Americans from, say, California are called Native Americans and sometimes even identified with the name of their tribe or nation, but those from Coahuila or Baja California Norte are just “Mexican” (which is true, of course) with no recognition that they’re just as Native American as Pueblos, Arapahos, Navajos, Seminoles, etc.

This piece contends that Mexico is home to 65 distinct indigenous groups–though I’ve seen analyses that break those down further to get numbers in the hundreds. The amount of genetic difference between some indigenous Mexican populations and others is as great as the difference between Europeans and East Asians.

What still works in Qualtrics free accounts (3/20/2016)

In the last few months Qualtrics has begun handicapping its free accounts. For a couple of years they were the best deal in online research: the Qualtrics system, very few restrictions, and a price tag of $0.  Of course I should have known that the days of wine and data wouldn’t last forever. They appear to be over.

So, to save other researchers a little time (assuming this post shows up in Google), here is what my students and I have currently experienced. Of course, our experiences might not be representative, and things might change overnight (as they seem to have done recently).

Restrictions on Qualtrics “free accounts” (or “trial accounts”) AFAIK as of March 20, 2016:

  • No Downloading Data. This is the absolutely most important thing: newly-created accounts, starting a relatively short time ago (a couple of months?) are do  not allow download. You can look at your data only through Qualtrics’ “reports” or summary stats on a per-variable basis. Or that’s what I think the situation is. But no downloading means no correlations, no t-tests, no regression analysis, no ANOVA, no trend analysis, etc.
  • No Importing Survey Files. So if you have a survey file from a colleague, or a previous account, you can’t import it into Qualtrics, unless you have a paid account. That kinda bites.
  • No Viewing, Creating, or Managing Panels Linked to Collaborated Surveys. I am a “collaborator” (with my free account) on a multi-survey project housed in a colleague’s full account. The survey uses panels and validation. I apparently have no access to that.
  • Only one survey can be active at a time. But that was always a free account limitation; no change.
  • No Panel Data. Again, this was always a free account limitation, AFAICR.

As of now, I don’t know of any limitations on number of responses, number of surveys you can create in your account (as long as only one is active), etc.

It’s a little painful to me to see Qualtrics going in this direction, though it’s predictable and probably very good for their bottom line. Nearly a decade ago I was evangelizing for Qualtrics at my former university, singing the company’s praises, including the reasonable pricing for academics. Now, the “special plan for academics” is 1000 responses for $500. That probably doesn’t even register on some people’s radar. For me, however, doing research at a university with fairly little research support, it’s painful. We usually get about $600 per year for professional conferences–which, of course, covers about 1/3 of the costs of a national conference. Universities all over the US are in varying stages of budget crisis, so this situation is pretty common.

I think Qualtrics has realized it’s the dominant product right now, and has decided to charge what it can, because it can. Sadly, this leaves some academics out in the cold.

Migrated blog to webfaction centos 7 and php 5.6, fixed wordpress problem.

In case it’s of any use to anyone, here are the results of a couple hours of googling and reading Webfaction’s support (as well as php and wordpress help files).

After having my site migrated from a centos (5?) server to a centos 7 server with the excellent webhost webfaction, I discovered yet again that I am not a sysadmin or programmer or whatever. This blog would not load. Mostly navigating to this URL just caused the browser to try to download the index.php file instead of displaying its results. For the fix, click “more” (or whatever the link says). Most people do not want to know this; those who do will click 🙂 Continue reading Migrated blog to webfaction centos 7 and php 5.6, fixed wordpress problem.

American social/economic mobility: Interesting gender patterns

As usual, Five Thirty-Eight is awesome. This recent post about American socioeconomic mobility–the likelihood of an individual having a higher SES than her or his parents–is a great read for the demographically- or data-minded. Of particular interest are the male/female patterns in light of starting out wealthy vs. poor. Men and women have clearly different trajectories and opportunities. Fascinating stuff.

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 Intro to R and a Gambling Demo

p-values: Not as Passé as You Might Think

In a nice, thorough blog post with plenty of simulation goodness, Daniel Lakens (an experimental psychologist in The Netherlands) demonstrates pretty convincingly that recent reports of the death of p-values have been greatly exaggerated. I find it telling that a Bayesian statistician is coming to the aid of p-values. I don’t even know what to compare this to, but it’s cool.

Indigo Girls: November 14, 2015 – Babeville, Buffalo, NY

I’ve been an Indigo Girls fan since 1990, when a girlfriend gave me Closer to Fine on a mix tape. I followed their music–in recordings only–through their next two or three albums, and then on and off over the ones after that, but I’ve kept listening to those 1990s songs. I can sing along with most of their first record and Nomads, Indians, Saints. I love many of those songs, and think the rest are OK. So they were just a band to me, until last night. I had the sense that they were good in live shows, but that vague understanding didn’t approximate the reality: in recordings the Indigo Girls are really good–deeper, more meaningful music than most of what’s been out there for three decades–but in person they make sense. All sorts of things come together with a satisfying clicking sensation. Before last night I did not even quite know the difference between Amy Ray and Emily Saliers, but now it’s impossible not to know, and understand, that difference. Continue reading Indigo Girls: November 14, 2015 – Babeville, Buffalo, NY