ElMaestro
★★★

Denmark,
2011-11-05 18:11
(5333 d 16:54 ago)

Posting: # 7614
Views: 5,596
 

 ElMaestro's Silly-o-Meter [🇷 for BE/BA]

Dear all,

because bad habits apparently die hard, I am proud to present a fantastic new piece of buggy R code.

It is nothing less than a sensational Silly-o-Meter which takes the temperature of the way a model is specified and gives a diagnosis.

ElMaestros.Silly.o.Meter=function (Some.Model)
{
  mx = model.matrix(Some.Model)
  nRows = dim(mx)[1]
  nCols = dim(mx)[2]
  nSilly = 0
  for (c in 1: nCols)
   {
     n=0
     for (r in 1: nRows) {if (mx[r,c] != 0) n = n+1}
     if (n==0) nSilly = nSilly+1     
   }
  x = 100 * nSilly/nCols
  cat("Congratulations! You specified a model with a model matrix that is", x, "percent meaningless.\n")
}


How to use this magnificent tool:
If you have a model specified like
M = lm(logAUC ~ 0 + Trt + Per + Subj%in%Seq + Seq)

then simply run it with the simple syntax:
ElMaestros.Silly.o.Meter(M)

Good luck to everyone. Am looking forward to hearing some hi-scores.

Pass or fail!
ElMaestro
UA Flag
Activity
 Admin contact
23,653 posts in 4,991 threads, 1,570 registered users;
110 visitors (0 registered, 110 guests [including 28 identified bots]).
Forum time: 12:05 CEST (Europe/Vienna)

To propose that poor design can be corrected by subtle analysis techniques
is contrary to good scientific thinking.    Stuart J. Pocock

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