Questions tagged [goodness-of-fit]

Goodness of fit tests indicate whether or not it is reasonable to assume that a random sample comes from a specific distribution.

"They are a form of hypothesis testing where the null and alternative hypotheses are:

H0: Sample data come from the stated distribution
HA: Sample data do not come from the stated distribution

These tests are sometimes called *omnibus tests."

Reference:

Ricci, V. (2005). Fitting distributions with R. page 16.


Tag Usage

Questions on should be about implementation and programming problems, not about the statistical or theoretical properties of the technique.
Consider whether your question might be better suited to Cross Validated, the StackExchange site for statistics, machine learning and data analysis.

123 questions
0
votes
0 answers

Regarding chisq.test (x, p) function for goodness of fit, how does R tell the degree of freedom of chi-square?

If I test x against a Poisson hypothesis, then I use mean(x) as lambda to calculate p so df = k - 2; if against a Normal hypothesis, then I use mean(x) and var(x) to calculate p so df = k - 3. How can R return a chisq value without knowing the df…
0
votes
2 answers

Chi-Square Test of Independence in r

I have a technical question related to my df structure. It looks like this: Month District Age Gender Education Disability Religion Occupation JobSeekers GMI 1 2020-01 Dan U17 Male None None …
Moshep
  • 19
  • 6
0
votes
1 answer

How do I test the data to fit to the Poisson distribution with goodfit?

I have a data set with car arrivals per minute. I drew a histogram and fit to the Poisson distribution with the following R codes. #Aladdin Arrivals Datast <- read.csv("Vehiclecount.csv", header = T, sep=";", dec=",") hist(Datast$Arrival,…
0
votes
1 answer

Error: $ operator not defined for this S4 class while running hoslem.test

I'm working on an optimization of a logistic regression model made with glm, the optimization is a lasso regression using glmnet. I want to compare both models using the output of a Hosmer Lemeshow test and I get this output. For the glm I get > hl…
0
votes
1 answer

Vuong & Clarke test using output from mle in R?

I want to test which one of two non-nested models that I fit using stats4::mle in R provides a better fit using the Vuong and the Clarke test. Vuong (Econometrica, 1989): https://www.jstor.org/stable/1912557?seq=1#metadata_info_tab_contents Clarke…
shofla
  • 43
  • 6
0
votes
0 answers

How to calculate the R square for the raster data (.tiff) in the python

]2 I want to plot the regression line and calculate the regression coefficient. Along with that the R square/Goodness of fit. I have determined the regression line on the curve and calculated the coefficient of that regression line but not be able…
Ronak Jain
  • 19
  • 1
0
votes
1 answer

Problem with Goodness-Of-Fit tests for objects of class kppm in spatstat version 1.61-0

I am using different Goodness of fit tests for objects of class kppm. The goodness of fit tests in the attached code worked fine in version 1.59-0 of spatstat, but in the most recent version (1.61-0 and 1.61-0.019), there is an error related to…
0
votes
0 answers

Discrete Kolmogorov-Smirnov testing: getting wrong value when using rpy2 compared to pure R

I am trying to use the dgof module from R, in Python 3 via rpy2. I use it inside python as so: # import rpy2's package module import rpy2.robjects.packages as rpackages # Import R's utility package utils = rpackages.importr('utils') # Select a…
Astrid
  • 1,846
  • 4
  • 26
  • 48
0
votes
1 answer

NbClust nstart and iter.max options

I am interested in using the NbClust package to try and evaluate various classification solutions. I know that NbClust has methods to implement such algorithms but these are limited. In particular NBClust does not allow multiple starts or an…
Stephen Clark
  • 573
  • 3
  • 18
0
votes
0 answers

Performing Kolmogorov-Smirnov test for goodness of fit - scipy

I am trying to perform KS test goodness of fit for my data and estimated distribution. Plot is like this The code I am using and the results are as follows: sp.stats.kstest(df['col'], 'norm', args = (mean, sd), N =…
0
votes
1 answer

Quick way of finding a name of a variable with lowest component value

I have a function fitting a distribution and returning a vector consisting of distribution name, mean, sd, etc. I'm testing few distributions but I can't rely on gofstat() because it goes mad when there are too many zeros to consider. Therefore I…
ErrHuman
  • 335
  • 1
  • 13
0
votes
1 answer

in R, does a "goodness of fit" value exist for vegan's CCA, similar to NMDS's "stress" value?

I would like to know if there is a way to extract something similar to the metaMDS "stress" value from a vegan cca object? I've tried the goodness.cca function and its…
crazysantaclaus
  • 613
  • 5
  • 19
0
votes
1 answer

Posterior Predictive Check in JAGS - Dimension Mismatch Error

I'm wondering if someone can help me troubleshoot here. I'd like to do a goodness of fit assessment for the poisson log normal model below (this is just the simple test model). When I comment out the fit <- sum(resi[]) and fit.new <- sum(resi.new[])…
Michelle
  • 193
  • 1
  • 1
  • 6
0
votes
2 answers

Computing correlations and performing goodness of fit for prng testing

I'm following along with a description of a test for pseudo-random number generators, and attempting to implement the test in C. There's one thing I'm hung up on though. The text in question is as follows: Applies a correlation test on the Hamming…
Davigor
  • 373
  • 3
  • 15
0
votes
2 answers

Ranks and identification of elements in r

I have two vectors with different elements, say x=c(1,3,4) , y= c(2,9) I want a vector of ranges that identifies me the elements of vector x with 1 and those of y with 0, ie (1,2,3,4,9) -----> (1,0,1,1,0) How could you get the vector of zeros and…
albert
  • 305
  • 4
  • 12
1 2 3
8 9