Questions tagged [model-fitting]

Fitting parameters of a function to explain given data

414 questions
6
votes
1 answer

Producing an MLE for a pair of distributions in python

Ok, so my current curve fitting code has a step that uses scipy.stats to determine the right distribution based on the data, distributions = [st.laplace, st.norm, st.expon, st.dweibull, st.invweibull, st.lognorm, st.uniform] mles = [] for…
6
votes
1 answer

Fitting SIR model based on least squares

I would like to optimize the fitting of SIR model. If I fit the SIR model with only 60 data points I get a "good" result. "Good" means, the fitted model curve is close to data points till t=40. My question is, how can I get a better fit, maybe based…
Sam
  • 387
  • 2
  • 9
  • 22
6
votes
1 answer

Fitting complex model using Python and lmfit?

I would like to fit ellipsometric data to complex model using LMFit. Two measured parameters, psi and delta, are variables in a complex function rho. I could try with separating problem to real and imaginary part with shared parameters or piecewise…
Jur Kravla
  • 61
  • 1
  • 3
6
votes
5 answers

finding the best/ scale/shift between two vectors

I have two vectors that represents a function f(x), and another vector f(ax+b) i.e. a scaled and shifted version of f(x). I would like to find the best scale and shift factors. *best - by means of least squares error , maximum likelihood, etc. any…
Mercury
  • 1,886
  • 5
  • 25
  • 44
5
votes
1 answer

InternalError: stream did not block host until done; was already in an error state

stream did not block host until done; was already in an error state how to fix it using tensorflow keras model.compile( optimizer="adam", loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True), metrics=['acc']) …
mero
  • 179
  • 1
  • 8
5
votes
0 answers

Concurvity in parametric terms in GAM in R with mgcv

I have a GAM model (below) where SST_mean and NAO are numerical values, and cycle and region are categorical factors. I checked for concurvity using the concurvity function in mgcv. m2 <- gam(Strandings ~ s(SST_mean) + s(NAO, bs="re") + Cycle +…
mikejwilliamson
  • 405
  • 1
  • 7
  • 17
5
votes
3 answers

Fitting a Gumbel distribution with fitdistrplus

I'm trying to reproduce the code from this answer, however I have problems in doing so. I'm using the gumbel distribution from package VGAM and fitdistrplus. The problem emerges when doing: fit = fitdist(data1, 'gumbel', start = list(location = 0,…
AF7
  • 3,160
  • 28
  • 63
5
votes
3 answers

Gnuplot fit of a nested function

What is the proper way in gnuplot to fit a function f(x) having the next form? f(x) = A*exp(x - B*f(x)) I tried to fit it as any other function using: fit f(x) "data.txt" via A,B and the output is just a sentence saying: "stack overflow" I don't…
4
votes
1 answer

How to use scipy.stats.maxwell to find temperature?

I have speed data of many particles to which I want to fit the Maxwellian curve. I am trying to use the fit method from scipy.stats.maxwell to fit to my data and extract the temperature of the system from that. From the documentation, I am unable to…
Babaji
  • 398
  • 1
  • 4
  • 18
4
votes
0 answers

Using mice inputed data sets in GLM analysis; can pooled model fit indices be obtained?

I used mice to impute five missing data sets, saved as the object "allImputations" in the code below. I then needed to complete linear and dichotomous regression analyses across the imputed data sets (see below for a successful…
Clar_k
  • 41
  • 2
4
votes
1 answer

Input 0 of layer sequential is incompatible with the layer expected ndim=3, found ndim=2. Full shape received: [None, 1]

I am working with keras for text classification. After pre-processing and vectorization my train and validation data details is like bellow: print(X_train.shape, ',', X_train.ndim, ',', type(X_train)) print(y_train.shape, ',', y_train.ndim, ',',…
user13959036
4
votes
1 answer

Why is there a difference between do(lm...) and geom_smooth(method="lm")?

I have an external calibration curve that slightly goes into saturation. So I fit a polynomial of second order, and a dataframe of measured samples, of which I'd like to know the concentration. df_calibration=structure(list(dilution = c(0.1, 0.2,…
TobiO
  • 1,335
  • 1
  • 9
  • 24
4
votes
1 answer

Auto.arima() function does not result in white noise. How else should I go about modeling data

Here is the plot of the initial data (after performing a log transformation). It is evident there is both a linear trend as well as a seasonal trend. I can address both of these by taking the first and twelfth (seasonal) difference:…
4
votes
1 answer

Active Shape Models' fitting procedure doesn't converge with Statistical Model fitting function

I followed the Active Shape Models approach described by Tim Cootes in textbook and original paper. So far everything went well (Procrustes Analysis, Principal Component Analysis, preprocessing of images (contrast, noise)). Only the fitting…
Matthias
  • 4,481
  • 12
  • 45
  • 84
4
votes
2 answers

How to retrieve a list of the original variable names from a GLM call in R?

When using the glm function in R one can use functions like addNA or log inside the formula argument. Let's say we have a dataframe Data with 4 columns: Class, var1 which are factors and var2, var3 which are numeric variables and we fit: Model <-…
Herman Sontrop
  • 69
  • 1
  • 10
1
2
3
27 28