bvoggu
☆    

2010-08-18 09:49
(5373 d 12:18 ago)

Posting: # 5801
Views: 10,469
 

 least square mean calculation [General Sta­tis­tics]

Dear all
My name is Bharat kumar (Trainee in pharmacokinetics dept.)
In our company, calculations of least square mean were done according to SAS only.
But i want to learn all those manually in excel.

Up to my knowledge... LSM will be calculated by doing average of parameter of one treatment in period 1 and average of same in period 2, followed by dividing the sum of both averages by 2 (2 in case of two periods, right?).
My questions are:
  1. While doing calculations with same formula, i am getting correct values for AUCt, Cmax but for AUCinf i am getting different values.
    Anybody will help me about this issue???
  2. what is the formula for calculation of standard error of difference?
  3. Please suggest me a book especially for statistical part of PK?

Regards,
Bharat
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2010-08-18 16:15
(5373 d 05:52 ago)

@ bvoggu
Posting: # 5803
Views: 9,475
 

 least square mean calculation

Dear Bharat,

please search the forum before posting. What about this thread (and linked examples)?

❝ 1. While doing calculations with same formula, i am getting correct values for AUCt, Cmax but for AUCinf i am getting different values.


This is strange. Are you sure that you have complete data for AUCinf?
Maybe you have complete datasets for AUCt, Cmax and are calculating geometric means instead of adjusted (=LSM) means in all cases. Remember that simple mean = adjusted mean only for complete (balanced) datasets. Please check.

❝ 3. Please suggest me a book especially for statistical part of PK?


See this post. Newer editions of some textbooks are published as of today.

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
bvoggu
☆    

2010-08-19 11:24
(5372 d 10:43 ago)

(edited on 2010-08-20 07:58)
@ Helmut
Posting: # 5806
Views: 9,758
 

 least square mean calculation

Dear Helmut,
Thank you very much for immediate response
I did calculation for least square mean of test and reference product in a 2X2 cross over study (TR Vs RT), but i am getting correct values for Cmax and AUCt only, but not for AUCinf. Please check with the following data if possible...

SubID Period Treatment Sequence  AUCt     AUCinf
XR03    1       R         RT     7833     7926.2
XR04    1       R         RT     7622.2   7730.3
XR07    1       R         RT     6477.7   6546.2
XR10    1       R         RT    10528.1  10682.1
XR11    1       R         RT    10968.6  11269.8
XR14    1       R         RT     8472.2   8535.6
XR16    1       R         RT    11593.9  11786.0
XR18    1       R         RT     7353.6   7473.4
XR20    1       R         RT     6090.6   6137.7
XR03    2       T         RT     6484.3   6601.6
XR04    2       T         RT     8587.1   8739.8
XR07    2       T         RT     4201.9   4262.8
XR10    2       T         RT     9566.9   9741.1
XR11    2       T         RT    12203.3  12404.6
XR14    2       T         RT     8495.7   8575.0
XR16    2       T         RT    10392.5  10554.7
XR18    2       T         RT     7859.7   8021.7
XR20    2       T         RT     7463.3   7549.4
XR01    2       R         TR     9982.6  10101.9
XR02    2       R         TR     6774     6879.6
XR05    2       R         TR     6065.1   6247.4
XR09    2       R         TR     7789.5   7913.9
XR13    2       R         TR     6253.9   6390.1
XR15    2       R         TR     5965.3   6056.8
XR17    2       R         TR     5593.2   5682.8
XR01    1       T         TR     9902.2  10044.0
XR02    1       T         TR     6684     6906.9
XR05    1       T         TR     5813.7   5903.5
XR09    1       T         TR     7975     8116.1
XR13    1       T         TR     6925     7026.4
XR15    1       T         TR     5995.3   6075.5
XR17    1       T         TR     6094.7   6191.3


Calculation according to mine is AUCt-LSM 8.919 (T), 8.927 (R)
Calculation according to SAS default programme for AUCt-LSM 8.919 (T), 8.927(R)
But for AUCinf my results are-8.929 (R) and 8.974 (T)
But SAS programme results are-8.942 (R) and 8.936 (T)
I am not getting why these are different :confused:
excuse me for such a lengthy data....
Please clarify me that a balanced design is nothing but number of sub facing TR is equal to number of sub facing RT right?
what is the formula for calculation of standard error of difference?

I am getting these difference bcz of excel, Please clarify SAS and Excel results are different to some extent right? and please provide me calculation upto LSM with one of our's members formula
(mean_seq1+mean_seq2)/2 for balanced design or (mean_seq1*n1)+(mean_seq2*n2)}/(n1+n2) for unbalanced design (I thought that second formula is best because our data is unbalanced). But I am getting result only with first formula not with second. Please clarify this.

Regards,
Bharat
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2010-08-19 14:36
(5372 d 07:31 ago)

@ bvoggu
Posting: # 5809
Views: 9,335
 

 SE: SAS / PHX-WNL / manual

Dear Bharat,

please add a column with the subject's ID. Edit your original post instead of posting a new one. THX.

❝ Please clarify me that a balanced design is nothing but number of sub facing TR is equal to number of sub facing RT right?


Yes.

❝ what is the formula for calculation of standard error of difference?


SE(T-R)=sqrt[2×MSEresidual/(n1+n2)], where n1 and n2 are the numbers of subjects in sequences 1 and 2.


Edit: I played around with your dataset. I coded the subjects ID to 1-9, 1-9, 10-16, 10-16. I don't have SAS, but in Phoenix/WinNonlin v6.1 I could confirm SAS's results, both for AUCt and AUCinf.
Interestingly I got for SE(T-R):
          PHX     'manual'
AUC  0.0381181 0.0378191
AUCinf  0.0378947 0.0375974

Can one of our SAS-owners please check these results? Maybe my formula is wrong.

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
d_labes
★★★

Berlin, Germany,
2010-08-19 18:18
(5372 d 03:49 ago)

@ Helmut
Posting: # 5811
Views: 9,319
 

 Standard error

Dear Helmut, dear Bharat,

❝ Edit: I played around with your dataset. I coded the subjects ID to 1-9,

❝ 1-9, 10-16, 10-16. I don't have SAS, but in Phoenix/WinNonlin v6.1 I could

❝ confirm SAS's results, both for AUCt and AUCinf.

❝ Interestingly I got for SE(T-R):

          PHX     'manual'

AUC  0.0381181 0.0378191

AUCinf  0.0378947 0.0375974

❝ Can one of our SAS-owners please check these results?


Of course I will do you the favor.

          PHX     'manual' "The power to know"
AUC  0.0381181 0.0378191  0.03811805
AUCinf  0.0378947 0.0375974  0.03789467


❝ Maybe my formula is wrong.


Seems so :-D.
Try the following:
   SE(T-R)=sqrt(0.5*MSEresidual*(1/n1+1/n2))
AUCinf:  =sqrt(0.5*0.01130855*(1/9+1/7))= 0.03789467
.

Bahrat! Have a look at ElMaestros first sentence! Eventually that is your problem.

BTW: My SAS LSMeans are equal to Bahrats SAS LSMeans :cool:. That is finest software validation! SAS gives the same results regardless if in India or in Germany! Also it seems to make no difference if Bahrat or D. Labes calculates. Also it is not known which release of "Superior software" they use. That is highly satisfactory :lol:.

Regards,

Detlew
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2010-08-19 18:33
(5372 d 03:34 ago)

@ d_labes
Posting: # 5812
Views: 9,256
 

 Standard error

Dear D. Labes!

❝ ❝ Maybe my formula is wrong.


❝ Seems so :-D.

❝ Try the following:

SE(T-R)=sqrt(0.5*MSEresidual*(1/n1+1/n2))


THX, my manual doesn't give the formula at all and I was to lazy to look it up somewhere else.
So I improvised... :not really:

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
bvoggu
☆    

2010-08-20 12:51
(5371 d 09:16 ago)

@ d_labes
Posting: # 5817
Views: 9,154
 

 Standard error

SE(T-R)=sqrt(0.5*MSEresidual*(1/n1+1/n2))

AUCinf:  =sqrt(0.5*0.01130855*(1/9+1/7))= 0.03789467.


Hello Mr. Labes
I am very thankful for your response and may I know how to calculate MSE residuals here???

Regards,
Bharat
d_labes
★★★

Berlin, Germany,
2010-08-20 16:57
(5371 d 05:10 ago)

@ bvoggu
Posting: # 5819
Views: 9,181
 

 Not with EXCEL

Dear Bharat,

❝ ... may I know how to calculate MSE residuals here???


MSEresidual is the Mean square of the error term from an appropriate ANOVA with the terms (effects) treatment, period, sequence and subject within sequence in the ANOVA model.

Although it is in principle possible I would not recommend to do this in M$ EXCEL :no:. See this and related posts.
If you need a cheaper alternative then [image] consider using R.

If you insist in using a spreadsheet consider the evaluation via intra-subject contrasts T-R. See Senn, Chapter 3 or Chow and Liu, Chapter 3.3.

S Senn
Cross-over Trials in Clinical Research
John Wiley & Sons, Chichester (2nd ed. 2002)

S-C Chow and J-p Liu
Design and Analysis of Bioavailability and Bioequivalence Studies
Marcel Dekker, New York (3rd ed. 2009)

Regards,

Detlew
ElMaestro
★★★

Denmark,
2010-08-18 16:46
(5373 d 05:21 ago)

@ bvoggu
Posting: # 5804
Views: 9,589
 

 least square mean calculation

Dear Bharat,

❝ Up to my knowledge... LSM will be calculated by doing average of parameter of one treatment in period 1 and average of same in period 2, followed by dividing the sum of both averages by 2 (2 in case of two periods, right?).


In the simplest case, average the sequences rather than the periods.
If you are looking for a sneakier way of finding the values, then you need to extract the treatment effects from the fitted effect vector (often called greek beta).

Pass or fail!
ElMaestro
bvoggu
☆    

2010-08-20 09:41
(5371 d 12:26 ago)

@ ElMaestro
Posting: # 5814
Views: 9,245
 

 least square mean calculation

❝ If you are looking for a sneakier way of finding the values, then you need to extract the treatment effects from the fitted effect vector (often called greek beta).


Hi Mr.Gent
I didn't get you about sneakier way of finding. Because I am a beginner please clarify clearly...
In my data I am calculating the least square mean of reference and treatment separately. In my opinion you are telling about overall least square mean, right?.

Regards,
Bharat
ElMaestro
★★★

Denmark,
2010-08-20 11:34
(5371 d 10:33 ago)

@ bvoggu
Posting: # 5815
Views: 9,199
 

 LSMeans

Dear Bharat,

❝ I didn't get you about sneakier way of finding. Because I am a beginner please clarify clearly...


Sorry if I was not expressing myself in a clear fashion.
The normal linear model, written in matrix notation would look like this:

y=Xb+e

y is the vector of abserved values (log Cmax for example).
X is model matrix.
b is the coefficient vector.
e is the vector containg the residuals.

If you have software that fits this model, then it minimses ete (the sum of squares) by playing around with the values in the b vector. By laws of matrix logic, b has as many rows as X has columns, and that is one for each value to be fitted. From this you can extract values (LSMeans) for Test and Reference. Note that when a model with intercept is fitted, there is typically just one column in X that corresponds to an LSMean value; to find the other in such cases you will have to add and subtract a little in order to figger the other LSMean out.

Oh dear, this was not at all clear. Sorry.

Pass or fail!
ElMaestro
UA Flag
Activity
 Admin contact
23,424 posts in 4,927 threads, 1,667 registered users;
62 visitors (0 registered, 62 guests [including 6 identified bots]).
Forum time: 22:07 CEST (Europe/Vienna)

Patients may recover in spite of drugs or because of them.    John Gaddum

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5