50% off | Unlimited Data & AI Learning

Last chance! 50% off unlimited learning

Sale ends in


BayesDA (version 2012.04-1)

personality: Personality Data From an Experiment in Psychology

Description

This is a tree-way array showing responses to 15 possible reactions in 23 situations for 54 persons. It is used in the book as an example for posterior predictive checks.

Usage

data(personality)

Arguments

Format

The format is: num [1:15, 1:23, 1:54] 0 0 0 1 0 0 1 2 0 0 ... - attr(*, "dimnames")=List of 3 ..$ response : chr [1:15] "1" "2" "3" "4" ... ..$ situation: chr [1:23] "1" "2" "3" "4" ... ..$ person : chr [1:54] "1" "2" "3" "4" ...

Examples

Run this code
data(personality)
str(personality)
# Following code adapted from file personality3.R on the book's webpage:
nsubjects <- 6
nrep <- 7

test <- function (a){
  output <- as.vector(a)>0
  glm.data.frame <- data.frame (output, response, situation, person)
  glm0 <- glm (output ~
    factor(response) + factor(situation) + factor(person),
    family=binomial(link=logit),
    data=glm.data.frame)
  pred0 <- predict.glm (glm0, type="response")
  mean (ifelse(output, (1-pred0)^2, pred0^2))
}
data <- personality[,,1:nsubjects]
attrs <- attributes(data)
data <- ifelse (data>0, 1, 0)
attributes(data) <- attrs

Run the code above in your browser using DataLab