class: middle, inverse .leftcol30[ <center> <img src="https://github.com/emse-madd-gwu/emse-madd-gwu.github.io/raw/master/images/madd_hex_sticker.png" width=250> </center> ] .rightcol70[ # Week 10: .fancy[DOE & Power Analysis] ###
EMSE 6035: Marketing Analytics for Design Decisions ###
John Paul Helveston ###
November 03, 2021 ] --- class: inverse # Quiz 4
10
:
00
.leftcol[ ### Make sure to download the zip file on the first page! ] .rightcol[ <center> <img src="images/quiz_doge.png" width="400"> </center> ] --- class: inverse, middle # Week 10: .fancy[DOE & Power Analysis] ### 1. Design of Experiment ### BREAK ### 2. Design Efficiency ### 3. Power Analysis ### 4. Interactions --- class: inverse, middle # Week 10: .fancy[DOE & Power Analysis] ### 1. .orange[Design of Experiment] ### BREAK ### 2. Design Efficiency ### 3. Power Analysis ### 4. Interactions --- class: center, middle # Before we start, re-install {conjointTools} .code100[ ```r remotes::install_github("jhelvy/conjointTools") ``` ] --- class: inverse, middle, center # Main & Interaction Effects --- # .center[Full design space for 3 effects: A, B, C] <center> <img src="images/doe_cube.png" width=600> </center> --- # .center[Full design space for 3 effects: A, B, C] .leftcol[ # Example: _Cars_ ## A: Electric? (Yes+ or No-) ## B: Warranty? (Yes+ or No-) ## C: Ford? (Yes+ or No-) ] .rightcol[ <center> <img src="images/doe_cube.png" width=100%> </center> ] --- class: center ## Main Effects .leftcol40[ $$ ME(a) = $$ $$ \left( \frac{A + AB + AC + ABC}{4}\right) - $$ $$ \left( \frac{I + B + C + BC}{4}\right) $$ ] .rightcol60[ <center> <img src="images/main_a.png" width=550> </center> ] --- class: center ## Interaction Effects .leftcol[ $$ INT(ab) = $$ $$ \frac{1}{2}\left[ \left( \frac{AB + ABC}{2}\right) - \left( \frac{B + BC}{2}\right) \right] - $$ $$ \frac{1}{2}\left[ \left( \frac{A + AC}{2}\right) - \left( \frac{I + C}{2}\right) \right] $$ ] .rightcol[ <center> <img src="images/int_ab.png" width=550> </center> ] --- # .center[Example: Wine Pairings] .leftcol40[ meat | wine -----|------ fish | white fish | red steak | white steak | red ] -- .rightcol60[ ## Main Effects 1. **Fish** or **Steak**? 2. **Red** or **White** wine? ## Interaction Effects 1. **Red** or **White** wine _with **Steak**_? 2. **Red** or **White** wine _with **Fish**_? ] --- class: center, middle # Open `winePairings.Rmd` --- class: inverse, middle, center # Fractional vs Full Factorial Designs --- ## .center[Full Factorial Design] .leftcol[ ## Example: _Cars_ ## A: Electric? (Yes+ or No-) ## B: Warranty? (Yes+ or No-) ## C: Ford? (Yes+ or No-) ] .rightcol[ ```r library(conjointTools) levels <- list( electric = c(1, 0), warranty = c(1, 0), ford = c(1, 0) ) doe <- makeDoe(levels) recodeDoe(doe, levels) ``` ``` #> electric warranty ford #> 1 1 1 1 #> 2 0 1 1 #> 3 1 0 1 #> 4 0 0 1 #> 5 1 1 0 #> 6 0 1 0 #> 7 1 0 0 #> 8 0 0 0 ``` ] --- ## .center[Full Factorial Design] .leftcol[ ## Balanced? All levels appear an equal number of times. ## Orthogonal? All pairs of levels appear together an equal number of times. ] .rightcol[ ```r library(conjointTools) levels <- list( electric = c(1, 0), warranty = c(1, 0), ford = c(1, 0) ) doe <- makeDoe(levels) doe <- recodeDoe(doe, levels) doe ``` ``` #> electric warranty ford #> 1 1 1 1 #> 2 0 1 1 #> 3 1 0 1 #> 4 0 0 1 #> 5 1 1 0 #> 6 0 1 0 #> 7 1 0 0 #> 8 0 0 0 ``` ] --- ## .center[Fractional Factorial Design] .leftcol[ ## Balanced? All levels appear an equal number of times. ## Orthogonal? All pairs of levels appear together an equal number of times. ] .rightcol[ ```r doe[c(1, 3, 5, 6),] ``` ``` #> electric warranty ford #> 1 1 1 1 #> 3 1 0 1 #> 5 1 1 0 #> 6 0 1 0 ``` ] --- class: center, middle # Comparing Full and Fractional Factorial Designs # Open `cars.Rmd` --- class: inverse # Practice Question 1 .leftcol[ Consider the following experiment design a | b | c | Effect --|---|---|------- + | - | - | A - | + | - | B + | - | + | AC - | + | + | BC ] .rightcol[ a) Is the design balanced? Is is orthogonal? b) Write out the equation to compute the main effect for a, b, and c. c) Are any main effects confounded? If so, what are they confounded with? ] --- class: inverse, center # .fancy[Break]
05
:
00
--- class: inverse, middle # Week 10: .fancy[DOE & Power Analysis] ### 1. Design of Experiment ### BREAK ### 2. .orange[Design Efficiency] ### 3. Power Analysis ### 4. Interactions --- class: center ## We want to find `\(\boldsymbol{\beta}\)` by maximizing the log-likelihood <center> <img src="images/mle1.png" width=1000> <img src="images/mle2.png" width=500> </center> --- class: center ### Covariance of `\(\boldsymbol{\beta}\)` inversely related to matrix of 2nd derivatives <center> <img src="images/covariance.png" width=400> </center> -- ### Negative of the hessian evaluated at the MLE<br>solution is the **"Observed Information Matrix"** ## `$$\boldsymbol{I}(\boldsymbol{\beta}) = - \nabla_{\boldsymbol{\beta}}^2 \ln (\mathcal{L})$$` --- class: center ## "D-optimal" designs attempt to maximize the<br>"D-efficiency" of a design ## `$$D = \left( \frac{|\boldsymbol{I}(\boldsymbol{\beta})|}{n^p} \right)^{1/p}$$` where `\(p\)` is the number of coefficients in the model and `\(n\)` is the total sample size -- # D ranges from 0 to 1 # Designs are _more_ orthogonal as D --> 1 --- class: center, middle # Finding Efficient Designs # Open `efficiency.Rmd` --- class: inverse
20
:
00
## Your Turn .leftcol80[ 1. Individually, create a fractional factorial design of experiment for your team project. Are you able to identify a high D-efficient design with fewer trials than a full factorial design. Can you find a _balanced_ design that is also efficient? 2. Compare your results with your teammates. 3. As a team, consider whether there are any restrictions you should make on your design and examine the impact (if any) those restrictions have on your design efficiency. ] --- class: inverse, middle # Week 10: .fancy[DOE & Power Analysis] ### 1. Design of Experiment ### BREAK ### 2. Design Efficiency ### 3. .orange[Power Analysis] ### 4. Interactions --- class: center, middle # How many respondents do I need? --- class: center, middle # How many respondents do I need<br>_to get X level of precision on `\(\boldsymbol{\beta}\)`_? --- # Standard errors are inversely related to `\(\sqrt{N}\)` .leftcol[ ```r n <- seq(100) se <- 1/sqrt(n) plot(n, se, type = "l") ``` Standard errors also decrease with: - Fewer attributes - Fewer levels in each categorical attribute - More questions per respondent ] .rightcol[ <img src="figs/unnamed-chunk-12-1.png" width="432" /> ] --- class: center, middle ## Using {conjointTools}, we can run simulations to determine the necessary sample size for a specific model # Open `powerAnalysis.Rmd` --- class: inverse
20
:
00
## Your Turn .leftcol80[ Individually: 1. Using your design of experiment you just created in the last practice, conduct a power analysis to determine the necessary sample size to achieve a 0.05 significance level on your parameter estimates. 2. Compare your results with your teammates. ] --- class: inverse, middle # Week 10: .fancy[DOE & Power Analysis] ### 1. Design of Experiment ### BREAK ### 2. Design Efficiency ### 3. Power Analysis ### 4. .orange[Interactions] --- class: center, middle # Open `powerAnalysis_interactions.Rmd`