Hi, I've been testing some models with the MCMCpack library. I can run the process and get a nice model "object". I can easily see the summary and even plot it. I can't seem to figure out how to: 1) Access the final coefficients in the model 2) Turn the coefficients into a model so I can then run predictions using them. A summary command will SHOW Me the coefficients, but I can't run a "predict" with them. Can someone suggest how to pull them out and format them so that I can run some predictions to test the quality. I thought something like "as.model" would be there, but isn't. For example. foo <- MCMClogit(label ~ x1 + x2) summary(foo) plot(foo) foo has all the info. How do I pull out the coefficients and format them into a "standard" logit model?? Thanks! -N
Try this: apply(foo, 2, mean) or apply(foo, 2, median) Thanks, Deb>>> Noah Silverman <noah@smartmediacorp.com> 22/09/2009 12:34 pm >>>Hi, I've been testing some models with the MCMCpack library. I can run the process and get a nice model "object". I can easily see the summary and even plot it. I can't seem to figure out how to: 1) Access the final coefficients in the model 2) Turn the coefficients into a model so I can then run predictions using them. A summary command will SHOW Me the coefficients, but I can't run a "predict" with them. Can someone suggest how to pull them out and format them so that I can run some predictions to test the quality. I thought something like "as.model" would be there, but isn't. For example. foo <- MCMClogit(label ~ x1 + x2) summary(foo) plot(foo) foo has all the info. How do I pull out the coefficients and format them into a "standard" logit model?? Thanks! -N ______________________________________________ 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. [[alternative HTML version deleted]]
Deb, That's great!!! But, then how to I convert those values to a "model" so I can use a "predict" function. I can see: bar <- apply(foo,2,mean) That creates an object, "bar", with the coefficients. But, I can't call predict on bar... -N On 9/21/09 7:58 PM, Debabrata Midya wrote:> Try this: > apply(foo, 2, mean) or > apply(foo, 2, median) > Thanks, > Deb > > >>> Noah Silverman <noah@smartmediacorp.com> 22/09/2009 12:34 pm >>> > Hi, > > I've been testing some models with the MCMCpack library. > > I can run the process and get a nice model "object". I can easily see > the summary and even plot it. > > I can't seem to figure out how to: > 1) Access the final coefficients in the model > 2) Turn the coefficients into a model so I can then run predictions > using them. > > A summary command will SHOW Me the coefficients, but I can't run a > "predict" with them. Can someone suggest how to pull them out and > format them so that I can run some predictions to test the quality. I > thought something like "as.model" would be there, but isn't. > > For example. > > foo <- MCMClogit(label ~ x1 + x2) > > summary(foo) > plot(foo) > > foo has all the info. How do I pull out the coefficients and format > them into a "standard" logit model?? > > Thanks! > > -N > > ______________________________________________ > 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.[[alternative HTML version deleted]]