I don't see the problem with the following... the citations and
baseball data work fine, but my simulated data seems to give
BTm a headache. What am I missing?
---
library(BradleyTerry)
library(doBy)
ng <- 100
players <- factor( sort( c( "jeff", "mike",
"paul", "rich" ) ) )
np <- length( players )
p1 <- factor( c( rep( "jeff", ng )
, rep( levels( players ), np ) )
, levels=players )
p2 <- factor( c( rep( "mike", ng )
, rep( levels( players ), each=np ) )
, levels=players )
p1s <- c( rnorm( n=ng, mean=-0.5, sd=2 ), rep( 1, np^2 ) )
p2s <- c( rnorm( n=ng, mean=0.5, sd=2 ), rep( 0, np^2 ) )
results <- data.frame(
winner=factor( levels(players)[ ifelse(p1s<p2s,p2,p1)], levels=players )
, loser=factor( levels(players)[ ifelse(p1s<p2s,p1,p2) ], levels=players)
, Freq=c( rep( 1, ng ), rep( 1, np^2) ) )
results <- summaryBy(Freq ~ winner + loser, data=results, FUN=c(sum) )
attr(results, "names") <- c( "winner", "loser",
"Freq" )
results.btm <- BTm( results ~ .. ) # this spits out an error:
----
Error in BTm(results ~ ..) : subscript out of bounds
> sessionInfo()
R version 2.0.1, 2004-11-15, i386-pc-linux-gnu
attached base packages:
[1] "methods" "stats" "graphics"
"grDevices" "utils" "datasets"
[7] "base"
other attached packages:
BradleyTerry brlr doBy Hmisc
"0.8-5" "0.8-8" "1.6"
"3.0-1"
I have also tried this on Windows XP with R version 2.3.1 with same result.
--
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live
Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k