{"action":"created","issue":{"url":"https://api.github.com/repos/singmann/afex/issues/47","repository_url":"https://api.github.com/repos/singmann/afex","labels_url":"https://api.github.com/repos/singmann/afex/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/singmann/afex/issues/47/comments","events_url":"https://api.github.com/repos/singmann/afex/issues/47/events","html_url":"https://github.com/singmann/afex/pull/47","id":301580395,"number":47,"title":"Added support for transformed response to aov_car","user":{"login":"rvlenth","id":26777519,"avatar_url":"https://avatars2.githubusercontent.com/u/26777519?v=4","gravatar_id":"","url":"https://api.github.com/users/rvlenth","html_url":"https://github.com/rvlenth","followers_url":"https://api.github.com/users/rvlenth/followers","following_url":"https://api.github.com/users/rvlenth/following{/other_user}","gists_url":"https://api.github.com/users/rvlenth/gists{/gist_id}","starred_url":"https://api.github.com/users/rvlenth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rvlenth/subscriptions","organizations_url":"https://api.github.com/users/rvlenth/orgs","repos_url":"https://api.github.com/users/rvlenth/repos","events_url":"https://api.github.com/users/rvlenth/events{/privacy}","received_events_url":"https://api.github.com/users/rvlenth/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-03-01T22:16:48Z","updated_at":"2018-03-02T16:41:36Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/singmann/afex/pulls/47","html_url":"https://github.com/singmann/afex/pull/47","diff_url":"https://github.com/singmann/afex/pull/47.diff","patch_url":"https://github.com/singmann/afex/pull/47.patch"},"body":"Henrik,\r\n\r\nI added some code to `aov_car` that supports a response transformation.  If there is a transformation, the dv is computed and renamed, and the transformation is saved as the `\"transf\"` attribute of the returned object. The `emm_basis` method checks for this attribute and returns it appropriately if present. Thus, the response transformation is seamlessly integrated into subsequent calls to `emmeans`, be it univariate or multivariate.\r\n\r\nNOTE: The anova output, etc. is done for the transformed variable. The variable name used (and displayed in the summary) is composed of the transformation and the response name; e.g., `sqrt(count) ~ ...` creates a transformed response named `sqrt.count`.\r\n\r\nI did not add this support to `aov_ez` as I'm not sure how you'd want it implemented. The most natural thing seems to be to add, say, a `transform` argument that if non-missing, would incorporate it in the formula that is passed to `aov_car`. For example, `aov_ez(dv = \"yield\", transform = \"sqrt\")` creates the formula `sqrt(yield) ~ ...`. But another option might be just to support, e.g., `dv = \"sqrt(yield)\"`.\r\n\r\nExample (based on the help page):\r\n```\r\ndata(obk.long, package = \"afex\")\r\noblog <- aov_car(log(value) ~ treatment * gender + Error(id/(phase*hour)), \r\n                 data = obk.long, observed = \"gender\")\r\n## Contrasts set to contr.sum for the following variables: treatment, gender\r\n\r\nref_grid(oblog)\r\n## 'emmGrid' object with variables:\r\n##     treatment = control, A, B\r\n##     gender = F, M\r\n##     phase = fup, post, pre\r\n##     hour = X1, X2, X3, X4, X5\r\n## Transformation: “log” \r\n\r\nref_grid(oblog, model = \"mult\")\r\n## 'emmGrid' object with variables:\r\n##     treatment = control, A, B\r\n##     gender = F, M\r\n##     hour = multivariate response levels: X1, X2, X3, X4, X5\r\n##     phase = multivariate response levels: fup, post, pre\r\n## Transformation: “log” \r\n```"},"comment":{"url":"https://api.github.com/repos/singmann/afex/issues/comments/369977301","html_url":"https://github.com/singmann/afex/pull/47#issuecomment-369977301","issue_url":"https://api.github.com/repos/singmann/afex/issues/47","id":369977301,"user":{"login":"rvlenth","id":26777519,"avatar_url":"https://avatars2.githubusercontent.com/u/26777519?v=4","gravatar_id":"","url":"https://api.github.com/users/rvlenth","html_url":"https://github.com/rvlenth","followers_url":"https://api.github.com/users/rvlenth/followers","following_url":"https://api.github.com/users/rvlenth/following{/other_user}","gists_url":"https://api.github.com/users/rvlenth/gists{/gist_id}","starred_url":"https://api.github.com/users/rvlenth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rvlenth/subscriptions","organizations_url":"https://api.github.com/users/rvlenth/orgs","repos_url":"https://api.github.com/users/rvlenth/repos","events_url":"https://api.github.com/users/rvlenth/events{/privacy}","received_events_url":"https://api.github.com/users/rvlenth/received_events","type":"User","site_admin":false},"created_at":"2018-03-02T16:41:36Z","updated_at":"2018-03-02T16:41:36Z","author_association":"NONE","body":"OK, I added that argument. I also added documentation for it. You may want to place the argument earlier or later, but where I put it seems appropriate.\r\n\r\nAdditional example:\r\n```\r\naov_ez(\"id\", \"value\", obk.long, between = c(\"treatment\", \"gender\"), \r\n       within = c(\"phase\", \"hour\"), observed = \"gender\", transf = \"sqrt\", \r\n       print.formula = TRUE) -> obsqrt\r\n\r\n## Formula send to aov_car: sqrt(value) ~ treatment * gender + Error(id/(phase * hour))\r\n## Contrasts set to contr.sum for the following variables: treatment, gender\r\n\r\nref_grid(obsqrt)\r\n\r\n## 'emmGrid' object with variables:\r\n##     treatment = control, A, B\r\n##     gender = F, M\r\n##     phase = fup, post, pre\r\n##     hour = X1, X2, X3, X4, X5\r\n## Transformation: “sqrt” \r\n```"}}
{"actor":{"display_login":"rvlenth"}}