Re: [R] sem & testing multiple hypotheses with BIC

From: jebyrnes <jebyrnes_at_ucdavis.edu>
Date: Fri, 15 Aug 2008 14:31:00 -0700 (PDT)

Not that I know of. However, remember, the RAM format is just a matrix. It's fairly simple to write some code to scan through and make changes to models. For example, here's something to delete a specified path. It should be fairly simple to run through a set of paths, delete them piecewise, fit the model, and then get a BIC (or other information criterion) to create a BIC table. Then again, those wouldn't be a priori models, and might violate some of the spirit of using information criteria...

delete.model.element<-function (delete.text, old.model, sort.by="path") {

	#determine what sort of model element we'll be evaluating
	col.index<-0
	if(sort.by=="path"){col.index<-1}
	if(sort.by=="variable"){col.index<-1}
	if(sort.by=="coefficient"){col.index<-2}
	if(col.index==0) stop("Cannot delete a ", sort.by)

	#blank vectors to start with
	col1<-vector()
	col2<-vector()
	col3<-vector()

	#purge spaces from delete.text
	delete.text<-strip.white(delete.text)
	
	for (line.num in 1:length(old.model[,1])){
		#purge spaces from the relevant line, just in case this is a path
		old.model[line.num, col.index]<-strip.white(old.model[line.num,
col.index])                 
		#see if this is a line to be deleted
		if(!(delete.text %p.in% old.model[line.num, col.index])){
			col1<-c(col1,old.model[line.num,1])
			col2<-c(col2,old.model[line.num,2])
			col3<-c(col3,old.model[line.num,3])
		}
	}
	
	#now turn the columns into a RAM model
	ram<-cbind(col1, col2, col3)
	class(ram)<-"mod"
	return(ram)

}

Donald Braman-2 wrote:
>
> I'm coming from the AMOS world and am wondering if there is a simple
> way to do multiple hypothesis testing in the manner of BIC analyses in
> AMOS using the sem package in R. I've read the documentation, but
> don't see anything in there except for basic BIC scores. Perhaps
> someone has devised a simple way to compare the relative likelihood of
> all possible path-fittings within a specified set of paths?
>
>
>

-- 
View this message in context: http://www.nabble.com/sem---testing-multiple-hypotheses-with-BIC-tp18474096p19005157.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_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.
Received on Fri 15 Aug 2008 - 22:01:29 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 15 Aug 2008 - 22:33:46 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive