linear regression F-test [message #68340] |
Tue, 20 October 2009 06:44 |
Wout De Nolf
Messages: 194 Registered: October 2008
|
Senior Member |
|
|
Hi,
I'm struggling with the F-test after using REGRESS. The F-test goes as
follows:
H0: Y is linear independent from X's
Fcrit=F_CVF(alpha,nterm,npts-nterm-1) ; e.g. alpha=0.01
if (F >= Fcrit) then "H0 rejected"
else "Can't reject H0"
Or alternatively
alpha=1-F_PDF(F,nterm,npts-nterm-1)
if (alpha <= alphacrit) then "H0 rejected"
else "Can't reject H0"
I find that the F-test is passed often (i.e. H0 rejected) when Y
clearly doesn't depend on X in a linear way. In the code below I
illustrated my problem.
My question: is this normal and why?
Thanks,
Wout
pro test
npts=100
nterm=1
arg=findgen(npts)
X=fltarr(nterm,npts)
Y=exp(arg*0.1)+10*arg^3.
X[0,*]=arg
A = REGRESS( X, Y, yfit=yfit, ftest=F)
window
plot,arg,Y,psym=1
oplot,arg,yfit
;H0: Y is linear independent from X's
brejectH0=1b
alpha=1-F_PDF(F,nterm,npts-nterm-1) ;one-sided
print,(alpha le 0.01)?'At least one spectrum is linear associated with
the fitted spectrum':$
'No evidence of linear association with the spectrum'
print,'p-value',alpha
end;pro test
|
|
|