ElMaestro Hero Denmark, 20170829 10:20 Posting: # 17747 Views: 4,704 

Hi all, let us say we have an lm object for a BE analysis in a study where we have n treatments.Is there a way to use confint() to derive CI's for the difference of the i'th and j'th treatments (where obviously i!=j, and i is within 1..n and j is within 1..n) ?If not, is there another builtin function that achieves this goal? Google isn't my friend. Many thanks. — if (3) 4 Best regards, ElMaestro "(...) targeted cancer therapies will benefit fewer than 2 percent of the cancer patients they’re aimed at. That reality is often lost on consumers, who are being fed a steady diet of winning anecdotes about miracle cures." New York Times (ed.), June 9, 2018. 
d_labes Hero Berlin, Germany, 20170829 12:23 @ ElMaestro Posting: # 17749 Views: 4,321 

Dear Öberster Größter Meister, » let us say we have an lm object for a BE analysis in a study where we have n treatments.Ok. I assume we have. » Is there a way to use confint() to derive CI's for the difference of the i'th and j'th treatments (where obviously i!=j, and i is within 1..n and j is within 1..n) ?No. confint() gives you confidence intervals for the model parameters only.» If not, is there another builtin function that achieves this goal? Built in I know of none, if you mean a base R installation. Only from addon packages. Have a look at package multcomp. Or if you prefer using such beasts like "least square means" have a look at package lsmeans. BTW: Allatonce is not the preferred method of a big regulatory body. Pairwise lm objects (throwing away the data under those treatments not under consideration) will give you the opportunity to use confint() to derive CI's.— Regards, Detlew 
ElMaestro Hero Denmark, 20170829 14:45 (edited by ElMaestro on 20170829 14:58) @ d_labes Posting: # 17751 Views: 4,313 

Hi d_labes, thanks for your input. » No. confint() gives you confidence intervals for the model parameters only.Except when we fit the model with intercept, treatment first. Now the SE for whichever treatment is not the intercept, is the SE of the difference (and the other treatment effect is unestimable because of the intercept). The funny logic of linear models. I need to get my head around that aspect. » Or if you prefer using such beasts like "least square means" have a look at package lsmeans. When we look at treatment effect differences it does not matter how we define the effects by contrast coding. I don't absolutely need an LSMean; I can do with two model effects calcuated in any valid way as long as I can extract their difference. » BTW: Allatonce is not the preferred method of a big regulatory body. Yes, I have heard of that big regulatory body. But there is a problem. Allatonce is the preferred method of another big regulatory body. » Pairwise lm objects (throwing away the data under those treatments not under consideration) will give you the opportunity to use confint() to derive CI's.So if we are not considering the big agency, but the other big agency , and we are not throwing away treatments when fitting models, how would you approach the CI derivation in R? Many thanks. — if (3) 4 Best regards, ElMaestro "(...) targeted cancer therapies will benefit fewer than 2 percent of the cancer patients they’re aimed at. That reality is often lost on consumers, who are being fed a steady diet of winning anecdotes about miracle cures." New York Times (ed.), June 9, 2018. 
ElMaestro Hero Denmark, 20170829 23:18 @ ElMaestro Posting: # 17753 Views: 4,230 

Hi all, since no standard function exists which helps me along, I wrote the stuff below. The structure of the input file is like in the appendices for Schütz, Labes, Fuglsang's paper in the AAPS Journal. I am sure the code police will tell me this isn't efficient because the same could be achieved with fewer code lines or some apply family calls. I am sure that is correct. Does the code achieve its goal properly, though? That is a much more interesting question. Not at all throughly tested and certainly not validated.The purpose is to allow some CI info where we don't ask for "T/R" but perhaps for "R/T" or for "B/D" or "Foo/Bar", whatever.
— if (3) 4 Best regards, ElMaestro "(...) targeted cancer therapies will benefit fewer than 2 percent of the cancer patients they’re aimed at. That reality is often lost on consumers, who are being fed a steady diet of winning anecdotes about miracle cures." New York Times (ed.), June 9, 2018. 
mittyri Senior Russia, 20170830 08:11 @ ElMaestro Posting: # 17754 Views: 4,217 

Hi ElMaestro, » When we look at treatment effect differences it does not matter how we define the effects by contrast coding. I don't absolutely need an LSMean; I can do with two model effects calcuated in any valid way as long as I can extract their difference. Homecook is good, but sometimes you can go to restaurant: library("lsmeans") I like this package, there is even support for nested structures in latest version. — Kind regards, Mittyri 
ElMaestro Hero Denmark, 20170830 09:27 @ mittyri Posting: # 17755 Views: 4,231 

Hi Mittyri, » library("lsmeans") » confint(pairs(lsmeans(M, "Trt"), reverse =TRUE), level=1alpha*2) Thanks a lot. This really reminds me of someone who once told me that when I get a good idea then I can be quite certain that somewhere someone else had that same idea already. Have a good day. — if (3) 4 Best regards, ElMaestro "(...) targeted cancer therapies will benefit fewer than 2 percent of the cancer patients they’re aimed at. That reality is often lost on consumers, who are being fed a steady diet of winning anecdotes about miracle cures." New York Times (ed.), June 9, 2018. 
d_labes Hero Berlin, Germany, 20170830 19:55 @ ElMaestro Posting: # 17758 Views: 4,162 

Dear ElMaestro, » ... Yes, I have heard of that big regulatory body. But there is a problem. Allatonce is the preferred method of another big regulatory body. If you speak here FDAish have a look at this post. Unfortunately the reference is no longer found on the Indernet. — Regards, Detlew 