say I have a vector of observations which I wanna test against some distribution, say Poisson. I see there is a chisq.test(x, p) function, but it always uses df = k -1, where k is number of bins. Obviously I don't know the distribution parameters and estimate them using data, so losing df in the process. There isn't a df argument in the function. Hence the problem in using chisq.test is not able to properly tell it how many estimates are there in the p, so the chi-square uses wrong df. data = c(0, 0, 0, 1, 0, 1, 2, 2); lambda = mean(data); #0.75 bins = c(0, 1, 2, 3); #bins for grouping data x = c(4, 2, 2, 0); #number of observations for bins p = dpois(bins, lambda); chisq.test(x, p=p, rescale.p=TRUE); #the df should be number of bins - 1 - number of estimates, so 2, but R always uses df = k-1?