---
title: "Homework: Facebook Statistics"
author: 
  - "Joe Schmo"
  - "ECO 230: Business and Economics Research and Communication"
  - "Instructor: James M. Murray, Ph.D."
date: "`r format(Sys.time(), '%B %d, %Y')`"

output: 
#  html_document:
#    keep_md: yes
  pdf_document: 
    fig_width: 7
    fig_height: 3.5
    
params:
  output_format: 'all'
urlcolor: blue
---

## Data Set 

The data set comes from the following study on Facebook marketing and performance metrics:

Moro, S., Rita, P. and Vala, B., (2016) "Predicting Social Media Performance Metrics and Evaluation of the Impact on Brand Building: A Data Mining Approach" *Journal of Business Research*, Vol. 68, pp. 3341-3351. Available at https://www.sciencedirect.com/science/article/pii/S0148296316000813

Download and load into memory the data set:
```{r}
load(url("https://murraylax.org/datasets/facebook.RData"))
```

The data set includes statistics from 500 Facebook posts in 2014 related to the marketing of a globally known cosmetic brand. Facebook marketing is an important part of many businesses marketing strategy. Facebook interaction can help businesses build their brand and market new products. Marketing executives such statistics to better understand the effectiveness of their Facebook marketing.

The data set includes the following variables:

1. **Type**: Scale / Class: Nominal / Factor. Type of post. Possible outcomes are "Link", "Photo", "Status", and "Video"

2. **Month**: Scale / Class: Ordinal / Ordered factor. Month of the year for the post.

3. **Weekday**: Scale / Class: Ordinal / Ordered factor. Day of the week for the post.

4. **Hour**: Scale / Class: Ratio / Integer. Hour of the day - between 0 (12:00AM) and 23 (11:00PM)

5. **Paid**: Scale / Class: Binary / Integer. Dummy variable equal to 1 if a paid post, 0 if a free or unsolicited post.

6. **Reach**: Scale / Class: Ratio / Integer. Number of unique individuals who saw the post appear on their news feeds.

7. **Impressions**: Scale / Class: Ratio / Integer. Number of times the post appeared on people's news feeds (some individuals may have had the post appear more than once)

8. **EngagedUsers**: Scale / Class: Ratio / Integer. Number of unique individuals that clicked anywhere in the post. 

9. **Comments**: Scale / Class: Ratio / Integer. Number of comments on the post.

10. **Likes**: Scale / Class: Ratio / Integer. Number of likes for the post

11. **Shares**: Scale / Class: Ratio / Integer. Number of shares for the post

12. **Interactions**: Scale / Class: Ratio / Integer. The sum, Comments + Likes + Shares.

13. **Weekday.Int**: Scale / Class: Ordinal / Integer: Number associated with day of the week in **Weekday**

14. **Month.Int**: Scale / Class: Ordinal / Integer: Number associated with month in **Month**

## Exercises ##
 
**1. Load the packages `tidyverse` and `psych`. Load also the code for confidence intervals for the median and interpolated median.**

```{r, message=FALSE, warning=FALSE}

```

**2. Compute and interpret a 95% confidence interval for the mean number of likes of a Facebook post**
```{r}

```

 

**3. Compute the mean and interpret a 95% confidence interval for the mean for the number of shares generated by a Facebook post created on a Saturday**
```{r}

```



**4. Compare Facebook posts of photos versus videos. Is there statistical evidence that the median number of engaged users is higher for one type versus another type? **


```{r}

```




**5. Compare the number of shares on a Facebook post versus the number of comments. Report the median and interpolated median for shares and comments. Is there evidence that the median number of shares is higher than the median number of comments?**

```{r}

```


