pd <- position_dodge(0.3) 

## Gives count, mean, standard deviation, standard error of the mean, and confidence interval (default 95%).
##   data: a data frame.
##   measurevar: the name of a column that contains the variable to be summariezed
##   groupvars: a vector containing names of columns that contain grouping variables
##   na.rm: a boolean that indicates whether to ignore NA's
##   conf.interval: the percent range of the confidence interval (default is 95%)
summarySE <- function(data=NULL, measurevar, groupvars=NULL, na.rm=FALSE,
                      conf.interval=.95, .drop=TRUE) {

    # New version of length which can handle NA's: if na.rm==T, don't count them
    length2 <- function (x, na.rm=FALSE) {
        if (na.rm) sum(!is.na(x))
        else       length(x)
    }

    # This does the summary. For each group's data frame, return a vector with
    # N, mean, and sd
    datac <- ddply(data, groupvars, .drop=.drop,
      .fun = function(xx, col) {
        c(N    = length2(xx[[col]], na.rm=na.rm),
          mean = mean   (xx[[col]], na.rm=na.rm),
          sd   = sd     (xx[[col]], na.rm=na.rm)
        )
      },
      measurevar
    )

    # Rename the "mean" column    
    datac <- rename(datac, c("mean" = measurevar))

    datac$se <- datac$sd / sqrt(datac$N)  # Calculate standard error of the mean

    # Confidence interval multiplier for standard error
    # Calculate t-statistic for confidence interval: 
    # e.g., if conf.interval is .95, use .975 (above/below), and use df=N-1
    ciMult <- qt(conf.interval/2 + .5, datac$N-1)
    datac$ci <- datac$se * ciMult

    return(datac)
}

# Multiple plot function
#
# ggplot objects can be passed in ..., or to plotlist (as a list of ggplot objects)
# - cols:   Number of columns in layout
# - layout: A matrix specifying the layout. If present, 'cols' is ignored.
#
# If the layout is something like matrix(c(1,2,3,3), nrow=2, byrow=TRUE),
# then plot 1 will go in the upper left, 2 will go in the upper right, and
# 3 will go all the way across the bottom.
#
multiplot <- function(..., plotlist=NULL, file, cols=1, layout=NULL) {
  library(grid)

  # Make a list from the ... arguments and plotlist
  plots <- c(list(...), plotlist)

  numPlots = length(plots)

  # If layout is NULL, then use 'cols' to determine layout
  if (is.null(layout)) {
    # Make the panel
    # ncol: Number of columns of plots
    # nrow: Number of rows needed, calculated from # of cols
    layout <- matrix(seq(1, cols * ceiling(numPlots/cols)),
                    ncol = cols, nrow = ceiling(numPlots/cols))
  }

 if (numPlots==1) {
    print(plots[[1]])

  } else {
    # Set up the page
    grid.newpage()
    pushViewport(viewport(layout = grid.layout(nrow(layout), ncol(layout))))

    # Make each plot, in the correct location
    for (i in 1:numPlots) {
      # Get the i,j matrix positions of the regions that contain this subplot
      matchidx <- as.data.frame(which(layout == i, arr.ind = TRUE))

      print(plots[[i]], vp = viewport(layout.pos.row = matchidx$row,
                                      layout.pos.col = matchidx$col))
    }
  }
}
data = read.csv("../covid19_study1_clean_wide.csv", stringsAsFactors = FALSE)

## reverse coding
cols_data = c( "beliefs_norms_1")
data[,cols_data] = lapply(cols_data,  function(x) 8 - data[, x])

 # windsorize items
for (i in c(1:ncol(data))){
   if (is.numeric(data[,i])){
     m = mean(data[,i])
     s = sd(data[,i])
     if (length(which(data[,i] > m + 3*s)) > 0){
       data[which(data[,i] > m + 3*s),i] = m + 3*s
     }
    if (length(which(data[,i] < m - 3*s)) > 0){
       data[which(data[,i] < m - 3*s),i] = m + 3*s
     }
   }
 }
 

# get norm and intention ratings

data$norm_town_socialdis = scale(rowMeans(data[,c("norms_town1_2",  "norms_town1_4", "norms_town1_6", "norms_town1_10")]))
data$norm_close_socialdis = scale(rowMeans(data[,c("norms_close1_2","norms_close1_4", "norms_close1_6","norms_close1_10")]))
data$intention_socialdis = scale(rowMeans(data[,c("intentions1_2","intentions1_4","intentions1_6","intentions1_10")]))
data$self_beliefs = scale(rowMeans(data[,c("beliefs_safe_self_1","beliefs_safe_self_2","beliefs_safe_self_3","beliefs_safe_self_4","beliefs_safe_self_5")]))
data$other_beliefs = scale(rowMeans(data[,c("beliefs_safe_others_1","beliefs_safe_others_2","beliefs_safe_others_3",
                                      "beliefs_safe_others_4","beliefs_safe_others_5",
                                      "beliefs_safe_others_6","beliefs_safe_others_7","beliefs_safe_others_8")]))
data$norm_beliefs = scale(rowMeans(data[,c("beliefs_norms_1","beliefs_norms_2","beliefs_norms_3","beliefs_norms_4")]))

data$independence = scale(rowMeans(data[,c("selfconstrual_1","selfconstrual_2","selfconstrual_3","selfconstrual_4")]))
data$interdependence = scale(rowMeans(data[,c("selfconstrual_5","selfconstrual_6","selfconstrual_7","selfconstrual_8")]))

df_all = data
  
df_norm = data[which(data$condition %in% c( "message control", "norm")), ]

For any questions regarding this report, please contact Rui Pei at rui.pei@asc.upenn.edu.

Executive summary

In this study, we examined whether messages that incorporate descriptive norms would be effective at influencing people’s covid-related cognitions. Overall, the data did not provide evidence that norm-based messages would be perceived more favorabily and lead to increased social norm perception. We speculate that our norm manipulation may not have been salient enough. As seen in the example below, messages across conditions shared the same image and part of the description. As participants may have paid more attention on the images, it could be that our manipulation was not strong enough,