-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated documentation for v0.0.2 release
- Loading branch information
Showing
10 changed files
with
284 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,27 @@ | ||
|
||
# conjointTools 0.0.2 | ||
|
||
Interactions! | ||
|
||
## Summary of larger updates: | ||
|
||
- Added support for creating interactions among variables | ||
- Removed summary plot function to drop ggplot dependencies | ||
|
||
## Summary of smaller updates: | ||
|
||
- Added a few new examples on how to use the interactions argument. | ||
|
||
|
||
|
||
# conjointTools 0.0.1 | ||
|
||
* Created new functions for creating different experiment designs: | ||
- Created new functions for creating different experiment designs: | ||
- Full factorial | ||
- "D", "A", and "I" optimal designs | ||
* Modified previous functions for creating a coded survey from a given experiment design | ||
* Changed the output of the sampleSizer function to show the sample size (rather than the number of observations, which can be different since respondents may answer more than one choice question). | ||
- Modified previous functions for creating a coded survey from a given experiment design | ||
- Changed the output of the sampleSizer function to show the sample size (rather than the number of observations, which can be different since respondents may answer more than one choice question). | ||
|
||
# conjointTools 0.0.0.9000 | ||
|
||
* Added a `NEWS.md` file to track changes to the package. | ||
- Added a `NEWS.md` file to track changes to the package. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
library(conjointTools) | ||
library(ggplot2) | ||
|
||
# Compute and compare standard errors for different sample sizes | ||
|
||
# Example 1 ------------------------------------------------------------------- | ||
|
||
# A simple conjoint experiment about apples | ||
# The price attribute is continuous. | ||
# ALL interactions between each attribute are estimated | ||
# Full factorial design | ||
|
||
# Make the design of experiment | ||
doe <- makeDoe( | ||
levels = c(3, 3, 3), | ||
varNames = c("price", "type", "freshness"), | ||
type = "full" | ||
) | ||
|
||
# Make the survey | ||
survey <- makeSurvey( | ||
doe = doe, # Design of experiment | ||
nResp = 1000, # Total number of respondents (upper bound) | ||
nAltsPerQ = 3, # Number of alternatives per question | ||
nQPerResp = 6 # Number of questions per respondent | ||
) | ||
|
||
# Compute sample sizes | ||
results <- sampleSizer( | ||
survey = survey, | ||
parNames = c('price', 'type', 'freshness'), | ||
parTypes = c('c', 'd', 'd'), | ||
interactions = TRUE, # Add interactions between each attribute | ||
nbreaks = 10 | ||
) | ||
|
||
# Preview results | ||
head(results) | ||
|
||
# Plot results | ||
library(ggplot2) | ||
results$int <- ifelse(grepl("\\*", results$coef), TRUE, FALSE) | ||
ggplot(results) + | ||
geom_point(aes(x = size, y = se, color = coef), | ||
fill = "white", pch = 21) + | ||
facet_wrap(vars(int)) + | ||
scale_y_continuous(limits = c(0, NA)) + | ||
labs(x = 'Number of observations', | ||
y = 'Standard Error', | ||
color = "Variable") + | ||
theme_bw() | ||
|
||
# Example 2 ------------------------------------------------------------------- | ||
|
||
# A simple conjoint experiment about apples | ||
# The price attribute is continuous. | ||
# ALL interactions between each attribute are estimated | ||
# D-efficient partial factorial design | ||
|
||
# Make the design of experiment | ||
doe <- makeDoe( | ||
levels = c(3, 3, 3), | ||
varNames = c("price", "type", "freshness"), | ||
type = "D", | ||
nTrials = 15 | ||
) | ||
|
||
# Make the survey | ||
survey <- makeSurvey( | ||
doe = doe, # Design of experiment | ||
nResp = 1000, # Total number of respondents (upper bound) | ||
nAltsPerQ = 3, # Number of alternatives per question | ||
nQPerResp = 6 # Number of questions per respondent | ||
) | ||
|
||
# Compute sample sizes | ||
results <- sampleSizer( | ||
survey = survey, | ||
parNames = c('price', 'type', 'freshness'), | ||
parTypes = c('c', 'd', 'd'), | ||
interactions = TRUE, # Add interactions between each attribute | ||
nbreaks = 10 | ||
) | ||
|
||
# Preview results | ||
head(results) | ||
|
||
# Plot results | ||
library(ggplot2) | ||
results$int <- ifelse(grepl("\\*", results$coef), TRUE, FALSE) | ||
ggplot(results) + | ||
geom_point(aes(x = size, y = se, color = coef), | ||
fill = "white", pch = 21) + | ||
facet_wrap(vars(int)) + | ||
scale_y_continuous(limits = c(0, NA)) + | ||
labs(x = 'Number of observations', | ||
y = 'Standard Error', | ||
color = "Variable") + | ||
theme_bw() |
Oops, something went wrong.