The problem is not with the BMA function, but rather that you have made the 
common mistake of forgetting that you are smarter than the computer.  The 
variable Y below is a data frame (not a single numeric vector).  Now a smart 
person like you sees a single column in the data frame and understands that is 
the y-variable, most intelligent people would do the same thing, but the 
computer is not as smart as you, it sees a data frame (a form of a list, which 
is what the error is talking about), knows that it wants a vector, but is not 
smart enough to figure out the only column of the data frame is the vector to 
use, so gives an error instead.

You can either read the data in as a vector, convert the data frame to a 
vector, or use subscripting/indexing to pass only the vector to the function 
(or maybe a 4th alternative that I have not thought of yet).

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of David S. Schwarz
> Sent: Thursday, May 14, 2009 12:55 PM
> To: r-help@r-project.org
> Subject: [R] Bayesian Model Averaging
> 
> Hello R Group,
> 
> 
> 
> 
> 
> Below is the code I submit:
> 
> 
> 
> library("BMA")
> 
> X <- read.table("C:/Documents and
> Settings/Administrator/Desktop/coding.txt",header=TRUE)
> 
> Y <- read.table("C:/Documents and
> Settings/Administrator/Desktop/1DCS.txt",header=TRUE)
> 
> IGout<- iBMA.glm(X, Y, glm.family= gaussian(), verbose = TRUE,
> thresProbne0
> = 5 )
> 
> summary(IGout)
> 
> IGout
> 
> 
> 
> I get the following error message:
> 
> 
> 
> Error in model.frame.default(formula = Y ~ 1, data =
> nastyHack_____x.df,  :
> 
>   invalid type (list) for variable 'Y'
> 
> > summary(IGout)
> 
> Error in summary(IGout) : object "IGout" not found
> 
> > IGout
> 
> Error: object "IGout" not found
> 
> 
> 
> The data set X is 47 rows by 41 columns, all numeric. The vector Y is
> 47
> rows, all numeric.
> 
> 
> 
> This closely follows an example in the help but I can't find the
> problem.
> Can anyone help?
> 
> 
> 
> Dave Schwarz
> 
> 
> 
> 
> 
> David S. Schwarz & Associates
> 
> 4261 Americana Drive
> 
> Suite 229
> 
> Stow, OH 44224
> 
> ph: 330-945-4733
> 
> email: david.schw...@goodstats.biz
> 
> web site: www.goodstats.biz
> 
> 
> 
> 
> 
> 
> 
> 
>       [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to