yicaoting ★ NanKing, China, 2011-10-07 20:27 (4945 d 23:36 ago) Posting: # 7445 Views: 8,425 |
|
I started a query on Least Square Means (LSM) for unequal sequence several days ago. In that posting, the method of calculating LSM for unequal sequence data has been pointed out by ElMaestro, thanks to ElMaestro. Although new question on SE for LSM of R and T arises, it is less importance for estimated 90%CI of PE. I have tried my best to calculate SE to obtain the same results as WNL or SAS, but I failed. It's beyond my ability. So, let's paused the game of SE calculation. BTW: Before I start this question, I have already carefully learned this for several times. Today, before I try to manually calculate LSM for incomplete data, I first calculate it with WNL and SAS, the results puzzled me again. My dataset is Chow and Liu's famous data: Design and Analysis of Bioavailability and Bioequivalence Studies, Third Edition, Page 71. Dataset 1: Chow and Liu's famous data with no modification, let's call it full data Dataset 2: Chow and Liu's famous data, delete Subject # 24's data both in period 1 (R=55.175) and period 2 (T=74.575), let's call it unbalanced data Dataset 3: Chow and Liu's famous data, delete Subject # 24's data only in period 2(T=74.575), let's call it incomplete data For convenience, all my analysis used original data without Ln() transformation. For dataset 2, the results of LSM of R and T and 90%CI of (R-T) and identical between WNL and SAS: LSM_R: 83.9525 (SE and 90%CI are different between WNL and SAS) For dataset 3, results from WNL: LSM_R: 82.5594 (WNL) vs 82.5594 (SAS) Obviously, the results are different. So my question are: 1) which is reliable? 2) for dataset3, how to manually calc LSM_T to obtain WNL's 79.6926 or SAS's 79.2074, I tried several methods, all were failed. 3) for dataset3, how to manually obtain WNL's R-T PE's SE=3.7492? Chow and Liu's data is: Sub Period Sequence Formulation AUC Thank you for your kind help. ![]() |
ElMaestro ★★★ Denmark, 2011-10-07 23:00 (4945 d 21:02 ago) @ yicaoting Posting: # 7446 Views: 6,965 |
|
Hi Yicaoting, that's an interesting post. ❝ For dataset 3, results from WNL: ❝ ❝ ❝ Obviously, the results are different. So my question are: ❝ 1) which is reliable? ❝ 2) for dataset3, how to manually calc LSM_T to obtain WNL's 79.6926 or SAS's 79.2074, I tried several methods, all were failed. ❝ 3) for dataset3, how to manually obtain WNL's R-T PE's SE=3.7492? Hrmmmmmmmfff... very good questions. I don't have a lot of insight. It is common in the linear BE model to disregard all data from any subject that has a missing value. That's why SAS treats dataset2 and dataset3 equally. I get the same result in R with the function call lm .However, there is -at least in theory- an alternative when one value is missing for a period in one (or more) subject(s) and that is to try a maximum likelihood approach where you specify subject as random in the mixed model and trt+seq+per all fixed. When I do that in R, I actually can reproduce your values from WNL (but I do not have WNL on my machine so cannot play around). It could thus be that WNL actually uses a mixed model to obtain the estimates? Someone, go read the manual?! If this is indeed the case then I am pretty sure you can't obtain easily the treatment effects (they shouldn't be called LSM's if obtained by REML). At least from a theoretical perspective one can argue that the REML-based estimates are more credible, I think. But am no expert at all. I am still struggling with the SE's. Will get back to you if I manage to figure out something. EM. |
Helmut ★★★ ![]() ![]() Vienna, Austria, 2011-10-07 23:35 (4945 d 20:27 ago) @ ElMaestro Posting: # 7447 Views: 6,808 |
|
Hi Yicaoting & ElMaestro! ❝ ❝ For dataset 3, results from WNL: ❝ ❝ ❝ ❝ ❝ Hrmmmmmmmfff... Yessir. ❝ However, there is -at least in theory- an alternative when one value is missing for a period in one (or more) subject(s) and that is to try a maximum likelihood approach where you specify subject as random in the mixed model and trt+seq+per all fixed. When I do that in R, I actually can reproduce your values from WNL (but I do not have WNL on my machine so cannot play around). It could thus be that WNL actually uses a mixed model to obtain the estimates? Right guess. Phoenix/WinNonlin’s default in BE is: fixed: Sequence+Formulation+Period Therefore we get REML estimates. If we delete the random effect and specify the model as ‘all fixed’ Sequence+Formulation+Period+Subject(Sequence) WNL will spit out exactly SAS’ results (LSM_T, SE, Diff, and CI) for dataset 3. ❝ Someone, go read the manual?! Wasn’t necessary. ![]() — Dif-tor heh smusma 🖖🏼 Довге життя Україна! ![]() Helmut Schütz ![]() The quality of responses received is directly proportional to the quality of the question asked. 🚮 Science Quotes |
ElMaestro ★★★ Denmark, 2011-10-08 01:18 (4945 d 18:45 ago) @ Helmut Posting: # 7448 Views: 6,741 |
|
Thanks HS, ❝ Right guess. Phoenix/WinNonlin’s default in BE is: ❝ ❝ What Yicaoting then needs is a kind of formula which can render the SE of a mean difference and which allow missing values, hence an maxlikelihood-based solution. I googled a bit around now and I cannot find it. I am sure this is straightforward given a varcovar matrix for anyone equipped with a brain marginally larger than a walnut, but because of my genetic makeup (intelligence-wise I can only compete with certain amoeba) I am just not capable of deriving it. EM. |
Helmut ★★★ ![]() ![]() Vienna, Austria, 2011-10-08 16:48 (4945 d 03:15 ago) @ ElMaestro Posting: # 7450 Views: 6,684 |
|
Dear ElMaestro! ❝ […] a kind of formula which can render the SE of a mean difference and which allow missing values, hence an maxlikelihood-based solution. ❝ ❝ I googled a bit around now and I cannot find it. I am sure this is straightforward given a varcovar matrix […] Do you think that’s possible? RMLE is an iterative process. Even if you find a formula based on the variance-covariance-matrix, you would need to fire up some software to fill it up with numbers first. IMHO no ‘manual’ calculation possible here. ❝ […] intelligence-wise I can only compete with certain amoeba […] I play in the same league than you. — Dif-tor heh smusma 🖖🏼 Довге життя Україна! ![]() Helmut Schütz ![]() The quality of responses received is directly proportional to the quality of the question asked. 🚮 Science Quotes |
ElMaestro ★★★ Denmark, 2011-10-08 17:26 (4945 d 02:37 ago) @ Helmut Posting: # 7452 Views: 6,688 |
|
Dear HS, ❝ Do you think that’s possible? RMLE is an iterative process. Even if you find a formula based on the variance-covariance-matrix, you would need to fire up some software to fill it up with numbers first. IMHO no ‘manual’ calculation possible here. Yes, I think it is possible. VBA works with double precision reals if the user wants ( dim X as double etc) which is definitely good enough. I am rather sure that it is be possible to set up the entire thing in VBA/Excel although I would of course any day prefer a dedicated stats software. There are some practicalities around it, though:1. VB is interpreted, not truly compiled and executed as binary. This makes it quite slow for complex operations. 2. Setting up the algos in VBA would definitely be more than just a standard day at the office. Need support from underlying matrix routines. I made some months ago a matrix library from scratch in C and set up the algos for REML estimation and it actually worked fine. Was about 9000 lines IIRC, so it would be the same in VBA. My code was based on doubles, too, and achieved the same as R using d_labes's model specifications (see the legendary freedom thread). We need also to bear in mind that the math operations (plus, minus, log, sine etc) in themselves are never proven wrongly implemented in any VB operation; the wrong implementations come when people use the basic functions in an inappropriate manner to calculate something slightly more complex like standard deviations. Who's got 1000 hours spare time for this little task? — Pass or fail! ElMaestro |
Helmut ★★★ ![]() ![]() Vienna, Austria, 2011-10-08 18:02 (4945 d 02:01 ago) @ ElMaestro Posting: # 7453 Views: 6,700 |
|
Dear ElMaestro! ❝ ❝ RMLE is an iterative process. Even if you find a formula based on the variance-covariance-matrix, you would need to fire up some software to fill it up with numbers first. IMHO no ‘manual’ calculation possible here. ❝ ❝ Yes, I think it is possible. Cough; see my emphases above. ![]() ❝ I made some months ago a matrix library from scratch in C […]. Was about 9000 lines IIRC […] Helluva fun! ❝ see the legendary freedom thread ![]() ❝ Who's got 1000 hours spare time for this little task? Save your energy for NLYW. Even if you come up with a DLL, remember the Q&A: Results obtained by alternative, validated statistical programs are also acceptable except spreadsheets because outputs of spreadsheets are not suitable for secondary assessment. — Dif-tor heh smusma 🖖🏼 Довге життя Україна! ![]() Helmut Schütz ![]() The quality of responses received is directly proportional to the quality of the question asked. 🚮 Science Quotes |