# Field (2018). Chapter 19: Categorical data -- cats & dogs, entering raw data
LOGLINEAR(data = datasets$Field_2018,
data_type = 'counts',
variables=c('Animal', 'Training', 'Dance'),
Freq = 'Freq' )
# Field (2018). Chapter 19: Categorical data -- cats & dogs, entering raw counts
LOGLINEAR(data = datasets$Field_2018_raw,
data_type = 'raw',
variables=c('Animal', 'Training', 'Dance'),
Freq = NULL )
# Field (2018). Chapter 19: Categorical data -- cats & dogs, entering a table
# example of creating and entering a two-dimensional contingency table for 'data'
food <- c(28, 10)
affection <- c(48, 114)
Field_2018_cats_conTable <- as.table(rbind(food, affection))
colnames(Field_2018_cats_conTable) <- c('danced', 'did not dance')
names(attributes(Field_2018_cats_conTable)$dimnames) <- c('Training','Dance')
LOGLINEAR(data = Field_2018_cats_conTable,
data_type = 'cont.table',
variables=c('Training', 'Dance') )
# go to this web page to see many more examples of the LOGLINEAR function analyses:
# https://oconnor-psych.ok.ubc.ca/loglinear/LOGLINEAR_vignettes.html
Run the code above in your browser using DataLab