[R] sem package, suppress warnings

John Fox jfox at mcmaster.ca
Sun Jan 20 21:49:44 CET 2013


Dear Dustin and Steve,

For some reason, I didn't see Dustin's original message.

As documented in ?sem, the warn argument to sem() covers only warnings
directly produced by the optimizer,

	"warn: if TRUE, warnings produced by the optimization function will
be printed. This should generally not be necessary, since sem prints its own
warning, and saves information about convergence. The default is FALSE."

It doesn't cover the warnings produced by sem() itself. For that, you can do
as Steve suggests, or simply set options(warn = -1). The debug argument is
FALSE by default and if TRUE prints the iteration history and some
additional information; it is irrelevant to warnings.

I hope this helps,
 John

-----------------------------------------------
John Fox
Senator McMaster Professor of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada



> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> On Behalf Of Steve Taylor
> Sent: Sunday, January 20, 2013 3:22 PM
> To: Dustin Fife; r-help
> Subject: Re: [R] sem package, suppress warnings
> 
> Have you tried
> 
> suppressWarnings(sem(mod, S = as.matrix(dataset), N = 1000, maxiter =
> 10000, warn = FALSE))
> 
> 
> > -----Original Message-----
> > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On
> > Behalf Of Dustin Fife
> > Sent: Saturday, 19 January 2013 5:32a
> > To: r-help
> > Subject: [R] sem package, suppress warnings
> >
> > Hi,
> >
> > I'm using the sem package under conditions where I know beforehand
> that
> > several models will be problematic. Because of that, I want to
> suppress
> > warnings. I've used the following code
> >
> > sem(mod, S = as.matrix(dataset), N = 1000, maxiter = 10000,
> >             warn = FALSE)
> >
> > But I still get warnings. I've also tried adding "check.analytic =
> FALSE,
> > debug = FALSE," and that doesn't seem to do it either. Any ideas why
> it's
> > not working?
> >
> > It may be important to note that the command above is wrapped within a
> > function and I'm using "try()" to avoid errors.
> >
> > Thanks in advance!
> >
> >
> > --
> > Dustin Fife
> > PhD Student
> > Quantitative Psychology
> > University of Oklahoma
> >
> > 	[[alternative HTML version deleted]]
> >
> > ______________________________________________
> > 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.
> 
> ______________________________________________
> 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.



More information about the R-help mailing list