Braveheart! [R for BE/BA]

posted by ElMaestro  – Belgium?, 2020-07-13 10:13 (106 d 12:14 ago) – Posting: # 21681
Views: 9,688

Hi all,

The solution I posted is a total winner. :-D:-D:-D Where do I collect my medal? :-D:-D:-D

Will be happy to learn of performance on other datasets, in particular of differences between results or non-convergence (which is often something related to instability caused by the initial guess being too far from the optimum). Obviously, with this implementation the input format has to meet the expectation of the algo. For example, T and R coded as T and R, not A and B, in this implementation. All this is unrelated to the task of this thread and can be rather easily worked out as well.

A slight change this morning, for the initial guesses, less clumsy and more likely (in the nonrestricted fashion ;-) ) to reflect the optimal solution:

Some.Initial.Guesses=function(foo)
{
 #guess varT
 D1=subset(D, (D$Trt=="T"))
 m=lm(log(Y)~factor(Seq)+factor(Per)   , data=D1)
 varT=anova(m)["Residuals", "Mean Sq"]
 
 #guess VarWR
 D1=subset(D, (D$Trt=="R"))
 m=lm(log(Y)~factor(Seq)+factor(Per)+factor(Subj)  , data=D1)
 varWR=anova(m)["Residuals", "Mean Sq"] 

 #guess varBR
 D1=subset(D, (D$Trt=="R"))
 m=lm(log(Y)~factor(Seq)+factor(Per)   , data=D1)
 varBR=anova(m)["Residuals", "Mean Sq"] - varWR

 #guess varRT (between), must tbe closer to the other two betweens.
 ##perhaps mean is a decent guess.
 varRT=0.5*(varT+varBR)

 rslt=c(varT, varBR, varWR, varRT)
 return(rslt)
}

I could be wrong, but...

Best regards,
ElMaestro

No, of course you do not need to audit your CRO if it was inspected in 1968 by the agency of Crabongostan.

Complete thread:

Activity
 Admin contact
21,179 posts in 4,414 threads, 1,474 registered users;
online 4 (0 registered, 4 guests [including 3 identified bots]).
Forum time: Tuesday 21:28 CET (Europe/Vienna)

No computer has ever been designed
that is ever aware of what it’s doing;
but most of the time, we aren’t either.    Marvin Minsky

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