QQplot

library(reshape2)
foodL <- melt(food, id= 'ID')
dtafood <-split(foodL, foodL$variable)
lapply(dtafood, function(x){
  qqnorm(x$value)
  qqline(x$value, col = "blue")

  legend('topleft', paste("Food", x$variable[1], sep = "="))
})

Histogram

foodL <- melt(food, id= 'ID')
dtafood <-split(foodL, foodL$variable)

lapply(dtafood, function(x){
  hist(x$value)

  legend('topright', paste("Food", x$variable[1], sep = "="))
  
})

distrubution of dietary group

library(psych)
describe(food2)
                vars     n   mean     sd median trimmed    mad min     max
rice               1 10041 276.65 162.83 246.36  264.10 130.88   0 1589.60
corn               2 10041  17.49  64.26   0.00    0.49   0.00   0 1886.52
othercereal        3 10041  25.65  32.14  15.51   19.66  23.00   0  436.35
roots              4 10041  12.49  45.96   0.00    2.20   0.00   0 1037.72
Sugar              5 10041  10.95  16.43   5.00    7.61   7.41   0  282.60
beans              6 10041   5.96  18.04   0.00    1.83   0.00   0  416.37
leafy              7 10041  33.23  54.66  15.03   21.69  22.28   0  809.62
othervegetables    8 10041  49.52  70.11  26.19   35.50  38.82   0 1156.18
vitCfruit          9 10041   6.55  51.99   0.00    0.00   0.00   0 2740.00
otherfruit        10 10041  34.10 102.39   0.00   10.79   0.00   0 2285.62
fish              11 10041 109.91 117.82  81.35   91.35  86.97   0 2506.41
meat              12 10041  53.46  86.39  17.25   35.08  25.57   0 1141.59
poultry           13 10041  27.27  56.05   0.00   13.92   0.00   0  835.20
Eggs              14 10041  10.39  18.96   0.00    6.08   0.00   0  261.80
wholemilk         15 10041  11.64  48.71   0.00    0.22   0.00   0 1102.20
milkproducts      16 10041  11.72  91.92   0.00    0.00   0.00   0 2625.00
fats              17 10041   5.87  16.67   3.00    3.68   4.08   0  569.06
beverages         18 10041  42.74 147.37   6.25   14.01   9.27   0 3869.80
condiments        19 10041   1.94   5.27   0.00    0.74   0.00   0  135.00
miscellaneous     20 10041   3.57  28.23   0.00    0.12   0.00   0  945.00
                  range  skew kurtosis   se
rice            1589.60  1.09     2.75 1.62
corn            1886.52  6.93   105.73 0.64
othercereal      436.35  2.39    10.03 0.32
roots           1037.72  8.31   105.45 0.46
Sugar            282.60  3.27    20.73 0.16
beans            416.37  7.17    82.33 0.18
leafy            809.62  4.09    28.06 0.55
othervegetables 1156.18  3.32    21.64 0.70
vitCfruit       2740.00 22.82   883.40 0.52
otherfruit      2285.62  7.58    96.70 1.02
fish            2506.41  3.35    31.98 1.18
meat            1141.59  3.27    17.93 0.86
poultry          835.20  3.69    22.12 0.56
Eggs             261.80  2.80    13.06 0.19
wholemilk       1102.20  7.15    75.58 0.49
milkproducts    2625.00 13.65   244.17 0.92
fats             569.06 15.97   352.80 0.17
beverages       3869.80 10.35   166.17 1.47
condiments       135.00  7.75   117.96 0.05
miscellaneous    945.00 15.80   340.46 0.28
sum(complete.cases(food2))
[1] 10041

factor loading

pa6.out <-fa(food2, nfactors =6, scores=T, rotate ="varimax", fm="pa")
print(pa6.out$loadings, cutoff=0, digits=3)

Loadings:
                PA1    PA3    PA4    PA2    PA6    PA5   
rice             0.944  0.012  0.136  0.081 -0.042  0.065
corn            -0.328 -0.037  0.045 -0.001 -0.100  0.293
othercereal     -0.013 -0.017 -0.047  0.195  0.439 -0.081
roots           -0.046  0.040  0.005  0.018 -0.005  0.144
Sugar            0.056  0.017 -0.005  0.270  0.282 -0.014
beans            0.047 -0.025 -0.070  0.045  0.065  0.045
leafy            0.004  0.004  0.001 -0.106 -0.068  0.497
othervegetables  0.120  0.033 -0.114 -0.050  0.058  0.295
vitCfruit        0.030  0.068  0.003  0.005  0.106  0.048
otherfruit      -0.019  0.685  0.024  0.004  0.081  0.059
fish             0.112  0.012  0.757 -0.041 -0.011 -0.053
meat             0.092  0.006 -0.141  0.488  0.126 -0.071
poultry          0.086  0.027 -0.083  0.212  0.152 -0.038
Eggs             0.106  0.012 -0.087  0.047  0.184 -0.047
wholemilk       -0.032  0.051 -0.007 -0.027  0.202 -0.005
milkproducts    -0.042  0.050 -0.011  0.146  0.188 -0.007
fats             0.034  0.005  0.022  0.055  0.270  0.000
beverages       -0.012 -0.004  0.009  0.329 -0.023  0.006
condiments      -0.038 -0.005  0.100  0.197  0.126 -0.027
miscellaneous    0.026  0.469  0.001  0.020  0.070  0.046

                 PA1   PA3   PA4   PA2   PA6   PA5
SS loadings    1.068 0.706 0.659 0.594 0.558 0.474
Proportion Var 0.053 0.035 0.033 0.030 0.028 0.024
Cumulative Var 0.053 0.089 0.122 0.151 0.179 0.203

QQ plot for factor

histagram for factor

density plot

distrubution of factor score

describe(pa6.out$scores)
    vars     n mean   sd median trimmed  mad   min   max range skew kurtosis
PA1    1 10041    0 0.95  -0.14   -0.06 0.78 -2.35  7.71 10.06 0.96     2.64
PA3    2 10041    0 0.73  -0.20   -0.14 0.07 -1.03 19.41 20.43 9.32   148.79
PA4    3 10041    0 0.77  -0.17   -0.11 0.57 -1.43 15.08 16.51 3.00    27.17
PA2    4 10041    0 0.62  -0.17   -0.10 0.38 -1.64  8.01  9.65 2.82    14.64
PA6    5 10041    0 0.60  -0.14   -0.08 0.43 -2.47  6.99  9.46 2.40    12.63
PA5    6 10041    0 0.61  -0.15   -0.10 0.39 -1.11  9.23 10.34 3.34    22.96
      se
PA1 0.01
PA3 0.01
PA4 0.01
PA2 0.01
PA6 0.01
PA5 0.01