Skip to content

Instantly share code, notes, and snippets.

@jvcasillas
Created December 6, 2012 02:03
Show Gist options
  • Save jvcasillas/4221277 to your computer and use it in GitHub Desktop.
Save jvcasillas/4221277 to your computer and use it in GitHub Desktop.
r_code_for_ident_data
# A couple things about this script...
# All text that comes after a "#" sign implies a comment that will not
# be evaluated by R. All you need to do is copy and paste the contents
# of this script into R and it will perform an ANOVA and make a graph.
# It is important that your data (in your data file from the hw) are
# in the correct format. You need to have the following headers for
# each column: "participant", "ending", "stimulus", "proportion".
# Check the example file "tarea5.txt" if you need to compare.
# The following command reads the data file into R.
# Make sure you put the full path to the file specific to your system.
# It also creates a variable called "ident" because we are looking at
# identification data
ident = read.delim("/Users/casillas/Desktop/tarea5/tarea5.txt")
# This will summarize the data in the R console.
# It is a good idea to do this to make sure there are no errors.
summary(ident)
# Attach the data you just loaded so that you can perform statistical analysis
# and make graphs
attach(ident)
# Perform a within subjects ANOVA on the data.
# For this specific assignment you are looking for a significant interaction
aov.ident=aov(proportion ~ stimulus * ending+Error(participant/stimulus), data = ident)
summary(aov.ident)
# This code creates an interaction plot with the data (la curva sigmoidal).
# You can change the X and Y labels how you see fit.
interaction.plot(stimulus, ending, jitter(proportion,1), xlab="Estímulo", ylab="%ba")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment