Returning Confidence Interval Results from rptR

148 views Asked by At

I am running a for loop for repeatability analysis using rptR. I want to store all of the confidence interval results from each run of the repeatability analysis in a data frame. I use the following code in the loop to return the list of CI values:

for(i in 1:P){
  m1<-rptR::rpt(Behaviour~Temperature+(1|ID), grname="ID", data=Data, datatype="Gaussian", nboot=10, 
  npermut=10)
  R_value[i] <- m1$R
  CI_value[i] <- m1$CI
}

However, the CI value always comes back as 0.95 - stating that it is a 95% confidence interval, rather than providing me with the actual range of values for the CI. Does anyone know how to return the actual CI values?

Here is the model output from running rptR just once:

Repeatability for ID
R  = 0.847
SE = 0.134
CI = [0.484, 0.982]
P  = 0.00152 [LRT]
     0.015 [Permutation]
1

There are 1 answers

0
Ronak Shah On

I think you are looking to extract CI_emp instead of CI and since it will have more than one value better to store it in a list. Try :

R_value <- numeric(P)
CI_value <- vector('list', P)

for(i in 1:P){
  m1<-rptR::rpt(Behaviour~Temperature+(1|ID), grname="ID", 
                data=Data, datatype="Gaussian", nboot=10, npermut=10)
  R_value[i] <- m1$R
  CI_value[[i]] <- m1$CI_emp
}