yhoriuchi / projoint

A package for a more general, more straightforward, and more creative conjoint analysis
https://yhoriuchi.github.io/projoint/
Other
10 stars 0 forks source link

projoint() output when .qoi is not NULL #26

Closed yhoriuchi closed 1 year ago

yhoriuchi commented 1 year ago

@aaronrkaufman , can you make the following change for improvement?

  1. When we use set_qoi(), and specify a projoint_qoi object with projoint(), then .structure and .estimand should be automatically inherited from the projoint_qoi object.
  2. Then, if .structure = "choice_level", .ignore_position should be set to TRUE.
  3. In the Roxygen2 documentation for projoint(), for .ignore_position, we say, "TRUE (default) if you ignore the location of profile (left or right). Relevant only if analyzed at the choice level." But this is not quite an accurate explanation. The default is NULL (because the default .structure is "profile_level". The default for .ignore_position should be TRUE only if .structure is "choice-level." This condition (or conditions) should be set with or without using a projoint_qoi object.
aaronrkaufman commented 1 year ago

@yhoriuchi:

1) projoint_qoi objects don't have those slots -- do you think we should add them? 2) When would we want .ignore_position to be FALSE? Should we just always make this TRUE? 3) If .structure = "profile_level" and .ignore_position is TRUE, is this a problem? If it doesn't break anything, maybe we don't need to worry about this

yhoriuchi commented 1 year ago
  1. Yes, please add these slots!
  2. In a new project we are working on (police reform), we are interested in respondents' choice of the left column (status quo). Right? So we cannot ignore the position.
  3. If .structure is "profile-level," the unit of analysis is each profile, not profile-pair. So, setting whether to ignore the position does not make sense.
aaronrkaufman commented 1 year ago

I've fixed these things. Note: the new behavior is that if .qoi and .structure/.estimand are BOTH set, the values from .qoi override. If you agree, close the issue.

yhoriuchi commented 1 year ago

I checked your changes. The following part you added:

If  \code{.structure = "profile_level"} and this argument is \code{NULL}, it is automatically reset to \code{TRUE}.

should be:

If  \code{.structure = "choice_level"} and this argument is \code{NULL}, it is automatically reset to \code{TRUE}.

because the code you added is:

  if(.structure == "choice_level" & is.null(.ignore_position)){
    .ignore_position = TRUE
  }
yhoriuchi commented 1 year ago

See the warning messages on https://yhoriuchi.github.io/projoint/articles/index.html. Something is wrong. Even without specifying .estimand and .structure, we see the warning message. @aaronrkaufman ?

and this one:

mm2 <- [projoint](https://yhoriuchi.github.io/projoint/reference/projoint.html)(.data = out1,
                .qoi = qoi_2,
                .structure = "choice_level",
                .ignore_position = FALSE)

The code should not produce any message even after dropping .structure = "choice_level". Right?

aaronrkaufman commented 1 year ago

Yes, this is because projoint has defaults set for both .estimand and .structure. I can remove this warning or we can remove the defaults or we can suppress the warning just for the vignette. What do you prefer?

yhoriuchi commented 1 year ago

@aaronrkaufman . Please see https://yhoriuchi.github.io/projoint/articles/04-estimate.html. In this example, .strcture is NOT specified within `projoint().

qoi_1 <- [set_qoi](https://yhoriuchi.github.io/projoint/reference/set_qoi.html)(
  .structure = "profile_level",
  .estimand = "mm",
  .att_choose = "att1", 
  .lev_choose = "level1")

mm1 <- [projoint](https://yhoriuchi.github.io/projoint/reference/projoint.html)(.data = out1,
                .qoi = qoi_1)

Nevertheless, we see the warning message:

## Warning in projoint(.data = out1, .qoi = qoi_1): Both .qoi and .structure are
## specified; using the value from .qoi.

And we see the same warning message TWICE.

aaronrkaufman commented 1 year ago

I'm sorry, I explained it poorly above.

1) Because there is a default value of .estimand and of .structure, we will ALWAYS see both warnings if .qoi is set, unless the user resets .estimand = NULL and .structure = NULL. This is on purpose. 2) They are not the same warning: one is about .structure, the other is about .estimand.

Would you like me to remove this warning? I think it is important.

yhoriuchi commented 1 year ago

I see. Then, we perhaps don't need to show the warning message.

On Thu, Aug 17, 2023 at 10:08 AM Aaron R. Kaufman @.***> wrote:

I'm sorry, I explained it poorly above.

  1. Because there is a default value of .estimand, we will ALWAYS see that warning if .qoi is set. This is on purpose.
  2. They are not the same warning: one is about .structure, the other is about .estimand.

— Reply to this email directly, view it on GitHub https://github.com/yhoriuchi/projoint/issues/26#issuecomment-1682354423, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC332BDXGMCHMBUCFMAHCADXVYQUDANCNFSM6AAAAAA3SYTYY4 . You are receiving this because you modified the open/close state.Message ID: @.***>

aaronrkaufman commented 1 year ago

Will do.