Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: RE: RE: unpaired regression


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: RE: RE: unpaired regression
Date   Wed, 12 May 2004 19:29:18 -0500

I have no idea if this is appropriate for your problem, but if you do want
R2 values, how about randomly shuffling the values of assay2 and collecting
the R2 for different combinations.  

Something like this:

clear
 
 qui{
 	set obs 10
 	gen a1 = uniform()
 	gen a2 = uniform()
  
 	gen r2 = .
 	gen rn = .
      set obs 1000
 	gen index = _n  in 1/10
 	
 	forv i = 1/1000 {
  		gen a2_`i' = . 
  		replace rn = uniform() in 1/10
  		sort rn
            replace a2_`i' = a2[index] 
  		sort index 
  	}
 
 	forv i = 1/1000 {
 		qui reg a1 a2_`i' 
 	 	replace r2 = e(r2) in `i'
 		drop a2_`i'
 	}
}

sum r2


Side Note:

If I combine the above -forv- loop, so it looks like:

clear
 qui {
	set obs 10
 	gen a1 = uniform()
 	gen a2 = uniform()
   	gen r2 = .
 	gen rn = .
      set obs 1000
 	gen index = _n  in 1/10
  	forv i = 1/1000 {
  		gen a2_`i' = . 
  		replace rn = uniform() in 1/10
  		sort rn
            replace a2_`i' = a2[index] 
  		sort index 
            reg a1 a2_`i' 
  		replace r2 = e(r2) in `i'
  		drop  a2_`i'
  	}
 }

 sum r2
  
it only produces around 630 R2 values rather than 1000.  Is there something
I am missing?

Scott


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Wallace, John
Sent: Wednesday, May 12, 2004 10:57 AM
To: '[email protected]'
Subject: st: RE: RE: RE: unpaired regression

> Can anyone comment on whether Scott's suggestion would be appropriate 
> for
> the problem I'm working on?  The difference in R^2 between the samples
> indicates that it might be problematic.


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index