[R] Using df and pf

Schatzi adele_thompson at cargill.com
Wed Apr 27 22:43:56 CEST 2011


I wanted to use an F-statistic to get p-values for treatment differences. I
have parameter estimates and standard errors. I posted about combining the
parameters in a previous post, but here I would just like to test the
parameter differences by treatments (it is a nonlinear function). I
calculated an F-statistic for parameter a and treatments 1 and 2:
fstat=(a1-a2)/sqrt(SEa1^2+SEa2^2)

Here I am looking at the different values of fstat using the pf function and
the df function:
df1=20
df2=20
dfv<-rep(0,500)
pfv<-rep(0,500)

values<-6*sort(runif(500))-3

for (i in 1:500){
fstat<-values[i]
dfv[i]<-df(fstat,df1,df2)
pfv[i]<-pf(abs(fstat),df1,df2,lower.tail=FALSE)
}


Is it correct to use this pf curve? At first I was trying to use the df
function, but I did not understand the output so I plotted it to figure it
out.

I feel that I am doing something seriously wrong and am not sure what it is.

-----
In theory, practice and theory are the same. In practice, they are not - Albert Einstein
--
View this message in context: http://r.789695.n4.nabble.com/Using-df-and-pf-tp3479417p3479417.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list