[R] predict.gl1ce question

Richard Bonneau rbonneau at systemsbiology.org
Thu Dec 4 01:07:48 CET 2003


Hi,

I'm using gl1ce with family=binomial like so:
 >yy
       succ fail
  [1,]   76   23
  [2,]   32   67
  [3,]   56   43
  ...
[24,]   81   18

 >xx
          c1219       c643
X1  0.04545455 0.64274145
X2  0.17723669 0.90392792
...
X24 0.80629054 0.12239320

 >test.gl1ce <- gl1ce(yy ~ xx, family = binomial(link=logit), bound = 
0.5 )
or
 >omit <- c(2,3)
 >test.gl1ce <- gl1ce(yy[-omit,] ~ xx[-omit,], family = 
binomial(link=logit), bound = 1 )

this seems to work fine and as i change the shrinkage parameter 
everything behaves as expected.

if i try to get the fitted values (y-hat) using predict i have no 
problems:
 > predict.gl1ce(test.gl1ce)
  [1] 0.38129977 0.16513661 0.47666779 0.45348757 0.09916513 0.18167674
  [7] 0.11047684 0.15786664 0.14765670 0.40657031 0.19072570 0.80259477
[13] 0.36317090 0.35930557 0.23700520 0.17579282 0.18835043 0.52306049
[19] 0.28388953 0.41262864 0.29933710 0.43556139 0.15276727 0.73017401

***
I have problems, however, when i try to use predict.gl1ce() with 
newdata.

so, the following tries all give errors:
 > predict.gl1ce(test.gl1ce, xx, family=binomial(link-logit))
 > predict.gl1ce(test.gl1ce, xx)
 > predict.gl1ce(test.gl1ce, xx[omit,], family=binomial(link-logit))
Error in predict.l1ce(test.gl1ce, xx, family = binomial(link - logit)) :
         Argument `newdata' is not a data frame, and cannot be coerced 
to an appropriate model matrix

the following weak try also bombs:
 > predict.gl1ce(test.gl1ce, data.frame(xx), family=binomial(link-logit))
Error in eval(expr, envir, enclos) : attempt to apply non-function


I've tried quite a few variations. It seems I'm missing something, but 
if glm or gl1ce take a certain
data format then the corresponding predict me,thods should (what am i 
missing).

thanks,
Rico


Richard Bonneau
Institute for Systems Biology
Seattle, WA
206-732-1463
206-732-1299 (fax)




More information about the R-help mailing list