I have a Dataframe with 16 variables (x1, x2,...x16). The variables from 1 to 15 are parameters chosed to perform an experiment. The 16th variable is the measured paramater which describe the result of the experiment. The experiment is repeated a certein number of times, let´s say n, with constant value of the parameters (x1 to x15), i.e. with costant boundary conditions. In this way I have one serie of experiments. If the boundary conditions change, then I have a new serie of experiments where the experiment is repeated m-times. First, I would like to find out all the series of experiments in the dataframe. I think this could be done with the R-function "group_by". Then, I would like to find out the probability distribution of the 16th variable, i.e. the results of the experiment for each serie (i.e. group found with "group_by"). For this I was thinking to use the comand "distChoose". Otherweise I was thinking to fit the data with "fitdist" for two/three distributions and get the AIC. I Wold like to create a table where the AIC is saved for every tested distribution for each group.
I tried something like this:
grouping = group_by(Dataframe, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15)
grouplist <- group_split(grouping)
AIC <- integer(763)
for (i in 1:763){
if (length(grouplist[[i]][["x16"]]) > 2){
normal = fitdist(grouplist[[i]][["x16"]], "norm")
AIC[i] = normal$aic
}
Is there a better way to do it, or maybe a command in R that already exist? I am new to R and I am trying to learn it. Thank you all.