Reputation: 531
I have created a data frame like this
head(df)
DISTBin MSDBin
1 0 4.301515
2 20 5.599879
3 40 5.883236
4 60 6.430584
5 80 7.396374
6 100 7.561652
where the first column is a vector of distances (binned) and the second one is a vector of mean square differences for a given quantity.
I would like then to fit df$MSDBin ~ df$DISTBin using a Gaussian model.
I cannot use gstat
or similar since I don't have a variogram object (I had to compute the variogram by myself to discard pairs from the same ID).
Any help?
Upvotes: 1
Views: 154
Reputation: 531
I have found the answer myself.
Gau <- function(h,tau,sigma.sq,range){
return(tau + sigma.sq * (1-exp(-(h*h)/(range*range))))
}
Gau_Fit <- nls(MSDBin ~ Gau(DISTBin,tau,sigma.sq,range),
data = df,
start = list(tau = 0, sigma.sq = 10, range = 1000))
Upvotes: 2