ElMaestro
★★★

Denmark,
2011-11-05 18:11
(4527 d 16:35 ago)

Posting: # 7614
Views: 3,878
 

 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
22,957 posts in 4,819 threads, 1,636 registered users;
107 visitors (0 registered, 107 guests [including 7 identified bots]).
Forum time: 10:46 CET (Europe/Vienna)

With four parameters I can fit an elephant,
and with five I can make him wiggle his trunk.    John von Neumann

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