sem: Computes the standard error of the mean over an id variable.

Description Usage Arguments Examples

View source: R/sem.R

Description

This function will compute the standard error of the mean given a raw (trial-by-trial) dataset, a dependent variable of interest, an id variable (e.g., "subjects" or "items"), and a set of grouping variables (e.g., "condition"). It also outputs several statistics: SD, N, and confidence intervals.

Two versions of the function are provided. The standard sem function will accept dplyr-like arguments (without quotes) for column names. The other sem_ function works on quoted strings, and all grouping variables must be supplied as a vector of characters to the grouping argument.

Usage

1
2
3
sem(data, dv, id, ..., confint_sem = 1, return_interim_data = F)

sem_(data, dv, id, grouping, confint_sem = 1, return_interim_data = F)

Arguments

data

A dataframe or datatable

dv

Variable representing your dependent variable. Use the bare variable name when using sem.

id

Variable representing an id variable (e.g., "subject" or "item"). Use the bare variable name when using sem.

...

Variables to group by (e.g., conditions) when using sem. Use bare variable names separated by commas.

confint_sem

Size (in standard errors) for confidence intervals. Default confidence intervals are 1 SEM To get 95% confidence intervals, enter 1.96.

return_interim_data

TRUE or FALSE, whether to return the interim dataset (e.g., subject-level data) as well as the grand mean dataset (via a list object). By default (FALSE), only the grand mean dataset is returned.

grouping

Character vector of the set of variables to group by (e.g., conditions) when using sem_.

Examples

1
2
3
4
library(languageR)
lexdec.rt <- lexdec[lexdec$Correct=="correct",]
sem_summary.rt <- sem(data = lexdec.rt, dv = RT, id = Subject, Class, Complex)
print(sem_summary.rt)

jasongullifer/convenience documentation built on May 21, 2019, 10:31 a.m.