Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: factor analysis and bootstrapping


From   "Grant, Robert" <Robert.Grant@sgul.kingston.ac.uk>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: factor analysis and bootstrapping
Date   Wed, 1 Feb 2012 16:15:49 +0000

Dear Jurgen

I have done something similar. By far the best way to do it is by a short program, something like:

// example begins -------------------------------------------
// first, get the observed point estimates:
factor var1 var2 var3 ... var26, pcf factors(1)
rotate, promax // I hope this makes sense - I "don't do" oblique
matrix obsload=e(r_L)
forvalues i=1/26 {
	scalar obsload`i'=obsload[`i',1] // break the loadings vector up into scalars
}
// I was interested in % variance explained - you might want to add other stats in.
scalar obsload27=e(rho)
matrix obs=(obsload1,obsload2,obsload3, ... ,obsload27) // now they are all together in one matrix

// and here comes the program...
capture: program drop myboot
program define myboot, rclass 
	preserve
	bsample
	factor var1 var2 var3 ... var26, pcf factors(1)
	rotate, promax
	matrix bootload=e(r_L)
       forvalues i=1/26 {
		scalar bootload`i'=bootload[`i',1]
	}
	scalar bootexp=e(rho)
      restore
end

// now you use -simulate- to run the -myboot- program, creating one resample each time.
simulate load1=bootload1 load2=bootload2 load3=bootload3 ... load26=bootload26 ///
	explained=bootload27, noisily reps(1000) seed(1234) saving(myboot_loadings.dta, replace): ///
	myboot
bstat, stat(obs) n(999) // put the original number of observations into n()
estat bootstrap, all
// example end ------------------------------

Hope that helps!
Robert


Robert Grant
Senior Research Fellow in Quantitative Methods
Faculty of Health & Social Care Sciences,
St. George's, University of London & Kingston University,
Grosvenor Wing, Cranmer Terrace, London, SW17 0RE.
 
Email address robert.grant@sgul.kingston.ac.uk
Telephone +44 (0)20 8725 2281 
Website http://staffnet.kingston.ac.uk/~ku45386

> Date: Wed, 1 Feb 2012 01:45:27 +0000
> Subject: Re: st: factor analysis and bootstrapping
> From: njcoxstata@gmail.com
> To: statalist@hsphsun2.harvard.edu
> 
> The way -bootstrap- works hinges on taking one or more scalar results
> and looking at their distribution(s) under sampling with replacement.
> But you are trying to put a series of matrix results into a single
> variable. That won't work if only because you can't fit a matrix into
> a single value of a variable.
> 
> In addition, I don't understand why you are trying to -bootstrap-
> rotation. Where's the stochastic element in that? The same rotation of
> the same factor analysis results will give the same rotated results.
> It's like rotating from facing N to facing E, but doing it 1000 times.
> 
> I imagine what you want to do is -bootstrap- the whole shebang, i.e. a
> -factor- analysis followed by -rotate-, in which there will be
> variation because the factor analysis results will differ because of
> different samples. In that case, you would need to write a program to
> encapsulate both, and -- first point above -- taking each loading from
> the matrix and putting it into a separate scalar.
> 
> If you seek comment on Martin Weiss's advice, please give the specific URL.
> 
> Nick
> 
> On Tue, Jan 31, 2012 at 11:37 PM, Jurgen Sidgman <sidgman@uwm.edu> wrote:
> > A few months ago a post identical to the one I have here was made and answered by Martin Weiss. The problem is that I have not been able to execute following his advice. So here it goes.
> >
> > I want to bootstrap the factor loadings that I obtain after executing
> >
> > factor var1 var2., pcf
> >
> > to determine if the loadings are statistically different from zero at conventional levels. Without attempting the bootstrapping all works well. However trying the following commands rotate does not work and I cannot seem to find a solution:
> >
> > bootstrap, reps(1000): rotate
> > bootstrap load:e(L), reps(1000): rotate
> > bootstrap e(L), reps(1000): rotate promax
> >
> > I have also tried:
> >
> > bootstrap loadings=e(L), reps(1000): rotate promax
> >


This email has been scanned for all viruses by the MessageLabs Email
Security System.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index