[R] sem & testing multiple hypotheses with BIC

jebyrnes jebyrnes at ucdavis.edu
Fri Aug 15 23:31:00 CEST 2008


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.



More information about the R-help mailing list