Category Archives: etc.

Importing Multiple Access Databases in R

Having trouble importing your Microsoft Access Databases in R? Yeah, I had trouble <i>accessing</i> Access in R as well. After pouring 7/10’s of my soul into a project, it looked like I might have to analyze a dataset (over 100 Access Databases) in Excel, or worse, by hand. Luckily R, as always, came to the rescue. The trick that you’ll need is a library called “RODBC” — it’s a package that will allow Access’s notoriously stubborn ports to open wide for R to come in and grab information.

Below is a sample code for what I’ve been using.   Not all of my conventions are the best, and not all of them will work for you, so I’ll explain what some of these more specific variables do.

NOTE: if you use 32-bit Microsoft Office, you will need to use the 32-bit version of R. I know that seems stupid, but those are the rules!

###Begin Script
###This particular build is for one of our lab's projects, but you can edit however you like.
###This assumes that you store your results as "SubjectName001, SubjectName002, OtherSubject001, OtherSubject002".
###Before running the loop, you will need to change how many sessions you want to run (HowManySessions), when the loop starts (StartSession),
###and the pigeon's name. Make sure you are using the directory that all of your file RESULTS are stored in. No need for sessions!
library(RODBC)
Directory<-"C:\\Users\\Alexander\\Documents\\Projects\\Stimulus Movement\\Results\\"
 FileExtension<-".accdb"
 HowManySessions <- 30
 PigeonName <- "Raphael"
 StartSession <- 4501 ###Highlight from here down, and press CTRL+R to start the loop!
 for (i in 1:HowManySessions){
 SessionString<-paste(PigeonName,StartSession, sep="")
 db <- paste(Directory,SessionString,FileExtension, sep="")
 connection <- odbcConnectAccess2007(db)
 sqlTables(connection, tableType = "TABLE")$TABLE_NAME trial <- sqlFetch(connection, "TrialResults")


###Here's an example of pulling subsets of data out of the database.  
###Calculating accuracy between these two groups of information, and then attaching it to a data frame called "numbers" below.
movetrial = trial[trial$NoTouch==1,]
stattrial = trial[trial$NoTouch==0,]
moveACC = 1 - mean(movetrial$IncorrectCorrections)
statACC = 1 - mean(stattrial$IncorrectCorrections)
numbers = data.frame(PigeonName, StartSession, moveACC, statACC)
###Now, we export it to a comma separated spreadsheet.  Note that column names are turned off in this example!
write.table(numbers,
 file='C:\\Users\\Alexander\\Documents\\Projects\\Stimulus Movement\\Results\\omnibus.csv', row.names=F, col.names=F, append=T, sep=",")
 close(connection)
StartSession <- StartSession + 1
 }
###You can use this command to close all ODBC connections when you're done with your loop.
###odbcCloseAll()
Advertisements
Tagged , , , , , , ,

Scientific Writing and the Illusion of Objectivity

The past few months, my colleagues and I have been working on a manuscript.  We plan to submit it to a journal where it will be, like all other articles, peer-reviewed, commented on, and (hopefully) published.  This is how it works, and it’s how it has almost always worked.

As I have the role of first-author, it has been my role to write up the majority of the manuscript.  Our field demands APA Style formatting.  This style claims to be the most neutral of all formatting styles on the market, and it strongly recommends against using anything that could bias language, such as first-person accounts, descriptive adjectives, or anecdotes.  I get it — this is science, and science should be objective.  Therefore, we ought to write about it in the most objective way possible.  But how objective is the most objective way possible?

Although APA Style, and other forms of scientific writing, aim to be objective, I’m not so sure such a thing can be achieved.  There are a variety of reasons for this, and primary among them is that writing is a naturally subjective experience.  Writing is just a fancy way to commit introspection, and introspection was more-or-less struck down in the early 20th century for being too subjective.  Introspection, as Edward Titchenor used it, was a way for a person to describe their internal machinations.  This line of research fell by the wayside when John B. Watson hit the scene, and he would go on to make some pretty convincing arguments against introspection as a tool of objectivity.  Writing, as it’s normally used, is just a way for people to record their inner monologue, which is influenced by the environment, affect, mood, and personality.

I’d say that scientific writing is about as objective as anything you might find in a history textbook.  Both historical and scientific writing are encouraged to carry no bias, be accurate, etc… but both of these media are reports of past events.  So not only are these past events available for the author’s interpretation (as objective and neutral as she/he may try to be), but they depend on documentation.  Scientists try to record everything in real time — if they manipulate a variable, they write it down.  But what if it’s not written down?  Historians want to report from primary sources — but what if there is no primary source?  These examples lead to, at best, a modest reconstruction of the past based on our best available knowledge, and at worst, guesswork.

We can’t just submit numbers and equations to a journal for publication, which, in my mind, would be the only real way to be purely objective.  Authors are required to explain the data.  It’s in this explanation that things get hairy.  It would be one thing if scientists simply reported the basic relationships between numbers (i.e., this group’s mean was larger than this other group’s mean), but we’re asked to go beyond even that.  We have to prescribe a “why” to any data trend (or lack thereof).  Regardless of your thoughts on the nature of causality, it’s a pretty dangerous affair — especially if we are counting on scientific writing to be completely objective.  Scientists are going to describe data in a way that makes sense to them, and that often involves their background and history with the field.  I’m going through this now with a co-author, who has a different interpretation of our data set.  The mere fact that we have arrived to different conclusions ought to mean that we shouldn’t include any interpretation of the data in our report, if we are aiming to be objective.  After all, how objective is it if two people, who work in the same field, report the same data set differently (if only slightly)?

I don’t want to get too involved in a discussion about funding.  For the most part, scientists are going to do what’s best for science.  But, every scientist feels the need to #1, justify their existence, and #2, justify their funding.  It’s not the scientists fault either;  journals often push for their authors to draw links between their research and applied areas.  There’s a push to move away from “pure science” or “science for the sake of science” by drawing parallels between Important Issues and current studies.  This pushes, and will continue to push, scientific writing away from the realm of objectivity and things become more needlessly speculative.  Let’s not mention that this affects how data are interpreted.

Journals like PLoS ONE (Public Library of Sciences) are requiring authors submit their complete data sets whenever they have any experiment published.  This is a move in the right direction, at least in light of objectivity.  Not only does it lend an increased degree of accountability, but it allows the audience the ability to look at the unbiased, agenda-less numbers for themselves.   Scientific writing seems to be moving in two completely opposite directions, both towards and away from subjectivity.  Maybe one day, we’ll feed a computer all of our experiments’ specifications, give it the data, and it will automatically generate an article about the study.  There are ways to remove the human factor from scientific writing, but journals (or magazines) like ScienceNature, or Psychological Science seem less than interested to move in that direction.

Tagged , , , , , ,

Reviews Now at Earbuddy.net

My activity here has dropped off since September.  You can find most of my writing at Earbuddy.net.  It’s a good site, and you should check it out.

I’ll continue writing for I Might Be Wrong, but future posts will be less review-oriented.  I suspect I will talk more about more thoughts on science, philosophy, and psychology here now that I have somewhere to air out my “criticism”.

Competition as Motivation: the Curious Cases of Lou Reed, Paul McCartney, and Frank Black

Lou Reed is a notorious pain in the ass. In the late 1960’s, he fronted The Velvet Underground and wrote four albums with the band before leaving due to internal tension within the band. He would go on to release a solo album to critical and commercial apathy. His second solo album TRANSFORMER, produced by David Bowie, would be a creative success however, Reed would never be able to match these early heights. It’s a pattern that is all too uncommon in the music industry (and in several other media): artists peak early only to have their careers stall creatively. What’s missing? In many cases, creative tension within bands bring out the best, whether it being an internal or external form of competition.

Look at the Beatles.  Paul McCartney and John Lennon was two of the best songwriters of any generation — you put them together, and they create brilliant works of pop music.  Outside of the Beatles, the two never really reached the same creative highlights as they once did together in a band.  This trend isn’t exclusive to the Lennon/McCartney pairing though: we’ve seen it with Pink Floyd, Velvet Underground, the Pixies, Soundgarden, Guns ‘N Roses, Stone Temple Pilots, the Rolling Stones, Led Zeppelin, etc…  It happens all the time.  Usually the argument reverts to a simple explanation: these songwriters are good, but once they are combined with their bandmates, they have a certain chemistry that makes them greater than the sum of their parts.  Seems reasonable enough: put two good people together and you get a great product.  Instead of the effect being additive, it seems more like an exponential increase in quality.  What I’ve always wonder is: why?  Why does this happen?

There can be two kinds of competitions in regards to bands/artists making music: outward competition and inward competition.  Outward competition, as it sounds, involves the members of the band trying to gain fans, money, a record label, success, or some combination of the above.  This form of competition serves as motivation for bands in as much as once the goal is achieved, motivation is lost.  It’s no mistake that breakthrough albums are often the best for bands: it’s probably the album that the band tried hardest on.

The other kind of competition, inward competition, is what I attribute the failure of solo projects outside of band’s normal groups.  Frank Black wrote almost all of the Pixies music, but once the band dissolved and he went off on his own, that spark that his songwriting used to carry was (very often) missing.  The only thing that changed was the group of people he wrote the music around — not his fame, success, etc.  Frank Black was notorious for his aggressive (some would say tyrranical) leadership over the band.  For Black, the Pixies was a competition — it was a way for him to assert dominance over others.  What would be the best way for Black to assert his dominance? By writing the best songs.  Sound petty, oversweeping, or too simple?

In the instance of Lennon and McCartney, the two wrote music together in the first half of the Beatles’ career, and it wasn’t until later that the two starting writing separately.  Songs began becoming “more John” or “more Paul.”  When the Beatles really hit their stride (starting with Rubber Soul and following through to Abbey Road) they were writing mostly apart from one another, only to have the other half come in after the songwriting was done to add a few details.  If these two were becoming independent songwriters, why did their talent seem to take a hit once they went solo?  Probably to the surprise of no one, the band broke up because of creative differences — Lennon and McCartney would often try to one-up the other, and sometimes, it led to disastrous results.  Abbey Road was the last album the band recorded, and its second half features an amazing medley that feels as if the two are trying to outdo the other.  It works for the music, but it didn’t work for the band, and polarizing songs (like “Maxwell’s Silver Hammer”) proved to be their undoing.

Coming back to Lou Reed, the frontman for the heavily influential Velvet Underground, he’s an artist that released an album that actually could stand up to his previous band’s work.  His second album, Transformer, was a commercial and critical hit, succeeding his much maligned debut solo release.  Here’s the interesting thing though: after John Cale left Velvet Underground after White Light/White Heat, Reed was the sole songwriter for the band.  Without Cale, VU would go on to record to masterpiece albums: Velvet Underground and Loaded.  John Cale and Lou Reed didn’t always see eye to eye, and the result was a brand of music that was at odds with itself — Reed’s simple pop melodies would stand just at the forefront, while Cale’s psychedelic experimentation lurked just beneath.  Together, the two were able to create two of the greatest and most influential albums of all time, but it came at a price.  Cale left the band because of the turmoil between the two, so it would seem that the internal competition within the band would have dissipated.  It didn’t.  Without Cale, the Velvet Underground released two more albums that were (almost) as good as the first pair, and Reed was the only songwriter penning the tracks.

Much like Frank Black of the Pixies, Reed was an aggressive leader: he exerted his control over the band’s music with an iron fist.  After Loaded, he released his seltitled solo record, mostly with songs that were to be Velvet Underground tunes — the album passed by most consumers and critics without much fuss.  Even with ridiculously (and maybe even overqualified) session players from Yes, the album failed to make a splash.  It wasn’t until his second solo record, Transformer, that things started to really pick up.  Reed brought in David Bowie and (fellow Spider from Mars) Mick Ronson to handle production of his second solo album.  Bowie and Reed would later go on to have their own feuds and fights, but in 1972, they were able to create a career-defining album for Reed.  Transformer had what Lou Reed didn’t and what all the other Velvet Underground records had: musicians to compete with.  Against Bowie and Ronson, Reed was pushed to write “Walk on the Wild Side,” and “Satellite of Love,” two commercial hits that solidified Reed’s status as a solo artist.  Before this time, it was no secret that Bowie was competitive: he and Marc Bolan of T. Rex had friendship that exemplified this kind of competitive nature, so it may come as no surprise that Bowie and Reed would develop similar tendencies.  Reed would go on to develop a similarly competitive relationship while writing his third solo album, Berlin, with Bob Ezrin.  After that?  Reed wanted to produce himself, and the world was “gifted” with such albums as the limp Sally Can’t Dance and insane Metal Machine Music.

It seems that with most bands, there’s some sort of internal frustration — some sort of friction — that goes on.  In Oasis, Noel Gallagher’s songwriting was a way of controlling his brother; whatever Noel wrote, Liam had to (in theory) sing.  In Metallica, it was a way for James Hetfield and Lars Ulrich to vent their frustrations at one another (and seemingly everyone else in the world).  When Billy Corrigan tried to democratize the songwriting process in Zwan, it came up with mixed results, and when he went solo, it was near-disastrous.

Internal competition need not only be for antagonistic relationships.  An example from recent memory of friendly competition lies in the Raconteurs and Divine Fits.  Both of these bands are “supergroups” of two or more songwriters.  The Raconteurs featured Jack White and Brendan Benson taking turns one-upping the other in the studio.  The band’s two albums are both good — the competitive spirit the band takes into the studio pays off and both songwriters are better because of it.  Divine Fits, who have only released one album to date, consists of the songwriters of Spoon (Brit Daniel) and Wolf Parade (Dan Boeckner).  Similar to the Raconteurs, the band features dueling singer/songwriters, and the result of the competition is that both members’ turn in better performances than their “main” band’s latest offering.  Internal competition as motivation isn’t a bad thing — it’s just something that has to be managed and reined for the forces of good.

Tagged , , , , , , , , , , , , , , , , , , , , , ,

Loving Zune More Than Microsoft

 

Oh, Zune.  It’s be a long and stupid ride.  Our relationship has been a strange one to be sure, but now it is time that we have gone our separate ways.  We’ve seen it all, oh yes: the lows, the highs, and the lows again.

I was an original skeptic of Microsoft’s Zune service.  I liked the design of the original Zune put forth by Microsoft, but at its original price, it wasn’t such a steal.  Zune and its iPod equivalent cost roughly the same.  It was for this reason that I originally shied away from the device.  In fact, it wasn’t until much later, when I was gifted a Zune HD, that I came around to Microsoft’s side.  The Zune HD, you see, had a bit less capacity, but it made up for it with a sleek, beautiful design and wonderful hardware.  After over a year of using Apple’s MP3 player, Microsoft pulled me away with this new little device.

The Zune HD was promising.  It was very slim with a huge screen, and its touch-controlled interface worked better than I think most would have imagined.  The icing on the cake was the software program that accompanied the device: the Zune software was a competitor for iTunes — it allowed users to store their libraries of music and offered an online store with depth and breadth to rival Apple’s storefront.  Microsoft even offered a service for users that would enable them to have free streaming and downloads for $15 a month.  This $15 bucks even allowed users to keep 10 songs (DRM-free) at the end of the month — all other downloads were protected by DRM and would only work on PC’s and your Zune devices.  It was a good deal.  It was a good device.  Life was good.

But it didn’t stay good.

Microsoft announced a new brand of phone to compete with the iPhone: Windows Phone 7.  These devices used an OS that would look very familiar to fans of Zune — it looks like Microsoft was beginning to branch its Zune tentacles out.  Zune had already spread to Xbox, and now it was coming to the realm of smartphones.  But it wasn’t meant to be, apparently.  Software news updates started slowing on the Zune front, and eventually, Microsoft decided to discontinue manufacturing of Zune HD with no plans of future releases.  Microsoft stopped supporting the music service that was once to compete with Apple — users, such as myself, were made to dangle in the wind, hoping to hear some news about the company’s future plans for Zune.  Throughout everything, I tried to stay faithful to Zune — I really loved the software after all.  When I upgraded my smartphone to a DROID, the way I listened to music on-the-go changed, but I always made sure to come back to Zune at the end of the day.  I weened myself off of the Zune HD (knowing that there was absolutely no hope for an upgrade), and held out hope that the Zune software would be updated, even overhauled, for the upcoming Windows 8.

Windows 8 had a different plan though.  The service that would replace Zune, Xbox Music, was announced, and initially, I was excited.  As the spiritual successor of Zune, I hoped to experience the new software interface and make my transition.  Microsoft’s plans for Xbox Music and my expectations for it seemed to be opposed: Microsoft aimed to create a way to listen to music that was easy and casual — I was hoping for an interface that was for music-lovers and detail-oriented.  Xbox Music’s design has been pared down so that only the bare minimum is left.  I tried to get used to it, but it just wasn’t the same.

This all leads me here, with my head in my hands, waiting for iTunes to import my MP3 library.  iTunes, in all of its resource-hogging, inefficient glory.  I tried Microsoft; I tried so hard to make this — what I thought was between us — work.  I gave and gave, but somewhere along the line, you gave up and moved on.  I suppose it’s time for me too.

Tagged , , , , , , , , ,
%d bloggers like this: