I have a matrix with 11 columns named "env", with 1 response variable bounded between 0 and 1 ("R1") and 10 possible predictors ranging from "P1 to "P10". I would like to use a zero-inflated beta regression (r package and function "gamlss") to assess the individual effect of each predictor on my response variable summarizing the AIC, estimate and probability for each predictor in a table. The table should have the predictors as rows and model parameters (AIC, estimate and probability) as columns. This process must be repeated individually for the three coefficients of the beta distribution (MU, NU and SIGMA).
Here a subset of my data matrix (sorry for not being able to simulate it following the guidelines)
P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 R1
600 243.89 2.68 180.32 1753.62 5.15 16.11 46.59 1.52 0.96 0.04
674 259.43 1.49 174.06 1230.71 5.50 19.42 45.65 1.62 0.88 0.28
231 156.19 0.00 151.68 1002.93 5.22 12.76 50.38 1.63 1.00 0.00
624 256.53 8.58 181.32 1194.07 5.35 25.33 58.74 1.33 0.94 0.36
773 346.91 15.59 180.17 1665.10 4.99 26.65 39.74 1.13 0.93 0.21
468 186.84 6.13 172.11 1570.75 5.34 18.72 38.52 1.55 0.97 0.10
340 478.28 14.68 169.06 1685.20 4.81 14.17 112.48 1.65 0.98 0.00
719 401.34 14.57 180.84 1824.18 4.74 13.46 129.70 1.67 0.98 0.00
603 831.58 7.79 158.69 1675.99 5.49 35.08 109.76 1.40 0.62 0.00
355 463.96 3.39 174.65 1987.08 4.26 25.69 85.57 1.56 0.98 0.03
527 560.11 32.18 175.29 2661.40 4.69 50.79 84.67 1.30 0.92 0.14
603 313.94 20.98 163.86 3211.07 4.60 45.15 86.36 1.36 0.93 0.02
508 571.58 40.62 118.69 2842.65 5.11 53.89 57.88 1.31 0.99 0.13
270 191.50 0.35 176.33 3280.57 4.75 51.99 127.10 1.29 0.51 0.12
353 770.72 0.05 173.76 2079.63 5.46 39.12 141.40 1.26 0.51 0.16
166 488.43 12.40 164.20 2692.61 4.55 41.28 107.06 1.40 0.91 0.13
881 316.41 32.43 156.37 2883.55 4.15 29.20 71.32 1.59 0.89 0.21
013 734.83 20.08 156.98 2044.81 4.72 49.62 113.42 1.35 0.98 0.20
526 452.85 33.85 164.58 1795.64 5.01 26.16 87.38 1.54 0.95 0.06
Below the syntax for the gamlss function with the 3 coefficients:
m1.mu<-gamlss(formula= R1~P1, family=BEZI, data=env, method=RS(100))
m1.nu<-gamlss(formula= R1~P1, nu.formula= R1~P1, family=BEZI, data=env, method=RS(100))
m1.si<-gamlss(formula= R1~P1,si.formula= R1~P1, family=BEZI, data=env, method=RS(100))
and here is the structure of the table I am trying to get:
AIC.mu EST.mu PROB.mu AIC.nu EST.nu PROB.nu AIC.si EST.si PROB.si
P1
P2
P3
…
P10
I assume I should be able to automate this with a combination of "for loop", "lapply" or "apply" and "cbind" but unfortunately I cannot manage to get it working. Would be great if some of you guys could give me a hand. Many Thanks