plotrw | R Documentation |
This function allows to plot random walks.
plotrw(
data,
sims.df = NULL,
sims.df.col = "rw",
color = "black",
coordy = c(-absolutemax, absolutemax),
mu = NULL,
p = 0.5
)
data |
A vector containing the random walk to be drawn or a list containing multiple vectors. |
sims.df |
A dataframe containing simulations, including column "simid" and "index". Set to NULL if you don't want to display simulations. |
sims.df.col |
The name of the column of the simulation dataframe to compare to. |
color |
A color in which the Random Walk will be drawn. |
coordy |
A vector containing the minimum and maximum value of the y-coordinates to be drawn. |
mu |
If bits are summed up for a single step, this is the mean of the sum. |
p |
Indicate the probability of success for a single step. |
The Random Walk can be plotted by itself or in comparison to simulated data sets. GGplot2 is used to draw an image. A random walk typically goes +1 for every correct choice and -1 for every incorrect one. Depending on the amount of simulations, drawing might take a while. It might be wise to chose a smaller simulation set for this purpose.
p.rw <- plotrw(tbl$rw)
p.rw
plotrw(tbl$rw, sims.df = sims, sims.df.col = "rw", coordy = c(-50,50))
plotrw(list(exp = exp$rw, con = con$rw), mu = 5)
df$rw <- cumsum(ifelse(df$correct == TRUE, 1, -1))
plotrw(df$rw, p = 0.2) # 1 in 5 probability of success
sims1000 <- subset(sims, simid <= 1000)
plotrw(tbl, sims.df = sims1000)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.