So maybe a summary function could be better when I want to get a summary result. So simply wrap several steps into one function.
Well, I'm imagining that the S3 structure is more suitable. In this case, I can use the custom tidy method tidy.mmrm for mmrm summary results. Besides, how about the tidymodels package?
And I also want to wrap the emmeans functions inside, such as confint(), test() to get the CI and hypothesis testing.
The preliminary idea is to create a function called summarize_lsmeans(), or other names like s_mmrm_lsmeans() or s_get_lsmeans(). Considering the lsmeans can be computed by different models, such as mmrm, ancova and others, so we'd better define this function with corresponding classes.
Afterwards, the summarized function should return a class like stabiot.lsmeans so that users can use the tidy() function to get a tibble table for downstream analysis if needed.
Thus the steps should be these:
[x] Create a function to integrate calculation steps, including emmeans(), contrast() and test() from emmeans.
How do I conduct the MMRM analysis in R for superiority or non-inferiority trial design?
A brief summary can be seen at https://www.bioinfo-scrounger.com/archives/mmrm_hypothesis/.
So maybe a summary function could be better when I want to get a summary result. So simply wrap several steps into one function.
Well, I'm imagining that the S3 structure is more suitable. In this case, I can use the custom tidy method
tidy.mmrm
formmrm
summary results. Besides, how about thetidymodels
package?And I also want to wrap the
emmeans
functions inside, such asconfint()
,test()
to get the CI and hypothesis testing.The preliminary idea is to create a function called
summarize_lsmeans()
, or other names likes_mmrm_lsmeans()
ors_get_lsmeans()
. Considering thelsmeans
can be computed by different models, such asmmrm
,ancova
and others, so we'd better define this function with corresponding classes.Afterwards, the summarized function should return a class like
stabiot.lsmeans
so that users can use thetidy()
function to get atibble
table for downstream analysis if needed.Thus the steps should be these:
emmeans()
,contrast()
andtest()
fromemmeans
.