parallel prediction in asreml-r

From: stephen <asremlforum_at_VSNI.CO.UK>
Date: Fri, 21 Nov 2008 00:29:50 +0000

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"

-------------------- m2f --------------------

Sent using Mail2Forum (http://www.mail2forum.com).

Read this topic online here:
http://www.vsni.co.uk/forum/viewtopic.php?p=312#312

-------------------- m2f --------------------
Received on Sun Nov 21 2008 - 00:29:50 EST

This webpage is part of the ASReml-l discussion list archives 2004-2010. More information on ASReml can be found at the VSN website. This discussion list is now deprecated - please use the VSN forum for discussion on ASReml. (These online archives were generated using the hypermail package.)