Author Archives: Darrin Rogers

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…

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

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

Diversity goes back a long way

Some scientists analyzed the remains of four people who lived (and died) 2,000 years ago in London. In just these four people they found evidence of life (and possibly ancestry) in Africa, ancestors in southern Europe, and a woman who was “genetically male.” I guess London has been cosmopolitan for quite some time.

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

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

Trigger warnings fail to divide along classic lines

I’m really fascinated lately by how the concept of “trigger warnings” has divided various North American communities–academics, political pundits, students, abuse victims, civil rights advocates, etc. Mostly I’m fascinated because the issue doesn’t divide cleanly along traditional battle¬†lines like “left/right,” “progressive/conservative,” “male/female,” “individualist/collectivist,” etc.

There is now (2015, Fall) a compelling description of how this issue, arguably run amok,¬†basically shut down one professor’s course. This piece is notable because it’s not the standard rant about hypersensitive students, written by people who have very little sociocultural vulnerability–it’s a narrative from a professor attempting to expose and celebrate minority sexuality in film, a prof who doubles as a rape crisis counselor, a professor (sadly, this seems relevant) who is female and an ethnic minority. Demands¬†from a few (apparently highly fragile) students derailed what appears to have been a relevant, informative, iconoclastic, and edgy class. In other words, the things college should be about, in any “good liberal’s” fondest daydreams, were shut down by other liberals.

So it’s getting pretty interesting. It’s liberals against liberals up in here. Educators against educators. Students against students. I’ve got more pat phrases like that, but I’ll stop now.

Notably, not everyone is convinced that trigger warnings are destroying America. And my own experience, at a “public liberal arts” university in the Northeast/Midwest, has not included any “PC tyranny;” but, then again, I’m a middle-aged white male, so perhaps I’m not going to bear the brunt of this kind of thing even if it is happening around me. Some of my colleagues report increasing emotional fragility of students in regards to classroom content, but I have mainly noticed increased fragility in regards to¬†reading between class periods¬†and finding test questions based on lecture content that was¬†not in the PowerPoint slides.

I was slightly surprised to find¬†that AAUP has published an official statement about trigger warnings, calling them “infantilizing and anti-intellectual.” I don’t know that I’m comfortable going quite so far down that road, but I do recognize that the desire to protect the psychologically vulnerable can rub uncomfortably against other core values, particularly free speech.¬† 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.