[vsni.co.uk] Contact us
Author Message
Post new topic

  ASReml  ~  parallel prediction in asreml-r

stephen
Posted: Fri Nov 21, 2008 12:29 am Reply with quote
Joined: 05 Aug 2008 Posts: 4
Dear asreml-r fans,

I've been attempting to use a multiple regression model to predict an outcome at specific points in the data space. I thought that use of the "parallel" option in the call to predict.asreml would be the neatest option but am failing. Crashing to be exact.

The following script contains an example with comments to explain what I'm trying to get done. I'd appreciate any thoughts on where it's going wrong for me.

Thanks for any hints

Version stuff:
platform i386-pc-mingw32
version.string R version 2.8.0 (2008-10-20)
asreml(): 2.00 Library: 2.00bi Run: Fri Nov 21 11:07:56 2008

Code:

# a test data frame; 5 predictors~U(0,10) used to generate an additive linear response + noise
df <- data.frame(x1=runif(100,0,10),x2=runif(100,0,10),x3=runif(100,0,10),x4=runif(100,0,10),x5=runif(100,0,10))
df$y <- with(df,5+x1+x2+x3+x4+x5)+rnorm(nrow(df))

# linear model fit with asreml
df.as <- asreml(y~x1+x2+x3+x4+x5,data=df)

# predict at the average of the data space
df.fit1 <- predict(df.as,classify=list("x1:x2:x3:x4:x5"))$predictions$"x1:x2:x3:x4:x5"

# predict at a specific point in the data space  (1,1,1,1,1)
df.fit2 <- predict(df.as,classify=list("x1:x2:x3:x4:x5"),
  levels=list("x1:x2:x3:x4:x5"=list(x1=1,x2=1,x3=1,x4=1,x5=1)))$predictions$"x1:x2:x3:x4:x5"
 
# attempt prediction at two specific points in the data space - (1,1,1,1,1) & (2,2,2,2,2)
# this results in the 2^5 combinations of the nominated levels because I haven't specified 'parallel'
df.fit3 <- predict(df.as,classify=list("x1:x2:x3:x4:x5"),
  levels=list("x1:x2:x3:x4:x5"=list(x1=1:2,x2=1:2,x3=1:2,x4=1:2,x5=1:2)))$predictions$"x1:x2:x3:x4:x5"

# attempt to predict at two specific points by invoking the parallel option.
# This crashes my R session either immediately or eventually:
#
#"R for Windows GUI front-end has encountered a problem and needs to close.  We are sorry for the inconvenience."
#
# When it does work, the standard errors of the predictions do not agree with those estimated in df.fit2 or df.fit3
# at the corresponding predict points. Also the "est.status" field of the prediction table says "<NA>"
# which suggests some sort of internal problem?
df.fit4 <- predict(df.as,classify=list("x1:x2:x3:x4:x5"),
  parallel=c("x1","x2","x3","x4","x5"),
  levels=list("x1:x2:x3:x4:x5"=list(x1=1:2,x2=1:2,x3=1:2,x4=1:2,x5=1:2)))$predictions$"x1:x2:x3:x4:x5"

# Repeating with a smaller dimensionality (3) causes similar behaviour to the previous
df.fit5 <- predict(df.as,classify=list("x1:x2:x3"),
  parallel=c("x1","x2","x3"),
  levels=list("x1:x2:x3"=list(x1=1:2,x2=1:2,x3=1:2)))$predictions$"x1:x2:x3"
View user's profile Send private message Send e-mail
Arthur
Posted: Mon Nov 24, 2008 8:47 pm Reply with quote
Joined: 05 Aug 2008 Posts: 471 Location: Orange, NSW
Dear Stephen,

Dave replies:

The User's Guide is in error here - "parallel" is a logical argument so the call

df.fit4 <- predict(df.as,classify=list("x1:x2:x3:x4:x5"),
parallel=T,
levels=list("x1:x2:x3:x4:x5"=list(x1=1:2,x2=1:2,x3=1:2,x4=1:2,x5=1:2)))$predictions$"x1:x2:x3:x4:x5"

should give the desired result. I'll fix the manual for the next release.

_________________
Arthur Gilmour

Retired Principal Research Scientist (Biometrics)
View user's profile Send private message Send e-mail Visit poster's website
stephen
Posted: Mon Nov 24, 2008 9:48 pm Reply with quote
Joined: 05 Aug 2008 Posts: 4
Thanks Arthur (& Dave)

"Parallel=TRUE" solves the problem.
View user's profile Send private message Send e-mail

Display posts from previous:  

All times are GMT
Page 1 of 1
Post new topic

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum