简体   繁体   中英

p-value for a vector in R

I want to get the p-value of a vector of F value in R .

set.seed(12345)
dat <- data.frame(df = round(runif(n=10, min=5, max=10)), F=runif(n=10, min=1, max=50))
pf(q = dat[2], df1 = dat[1], df2 = dat[10, 1], ncp = 0, lower.tail = FALSE, log.p = FALSE)

I can do this by element-wise but couldn't figure out how to accomplish this for a vector. Any help will be highly appreciated. Thanks

The pf() function works on vectors. Try:

pf(q = dat$F, df1 = dat$df, df2 = dat[10, 1], 
   ncp = 0, lower.tail = FALSE, log.p = FALSE)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM