I downloaded this and that file. Then, I created histograms showing the daily cost and annual expenses per country. We observe that the histogram of cost21 is more symmetrical than the histogram of food21.
This is further confirmed by the Pearson skewness coefficients I calculated (pearsonII), which yield values of 0.4683039 and 0.5745134, respectively. However, if I use the moments package, I get exactly the opposite results, with values of 0.9714933 and 0.5786727, respectively.
Why is this happening? Which skewness coefficient values should I accept?
This is my code:
cost2021 <- costHealthyDiet[costHealthyDiet$Year == 2021, ]
cost21 <- cost2021$`Cost of a healthy diet`
food2021 <- foodExpenditureYear[foodExpenditureYear$Year == 2021, ]
food21 <- food2021$`Total food expenditure`
hist(cost21)
hist(food21)
pearsonII <- function(v){
3*(mean(v)-median(v))/sd(v)
}
pearsonII(cost21)
pearsonII(food21)
install.packages("moments")
library(moments)
skewness(cost21)
skewness(food21


momentsis not as reliable as the other one. – Kώστας Κούδας Jul 30 '23 at 10:09