Fit a parametric density to an constant piecewise Function in R, argument is missing error -
Suppose someone pulls me a histogram and I want to smooth it, and want to get a smooth function. Is there a way to do this in their R? (Histogram is not coming from the data, so the estimator of the kernel density is not suitable. Please tell me if you think I am wrong on this.)
So far, I have a parametric distribution of my histogram To do this, I reduce the integrity class error between my histogram and beta distribution. This is my code, where H is a piece-wise stability job with support [0; 1].
h < -function (x) (x> 0 & x & lt; 1) * 1Fit Beta and lieutenant-function (h) {function (alpha, beta) {dff 2 and lt; -Function (x) (H (x) -d beta (x, alpha, beta) 2 returns (integrated (define 2), 0,1)) res & lt; -constroptim (theta = c (1,1), f = dist, grad = null, ui = matrix (c (1,1), 1,2), ci = c (0, 0)) returns & lt; -res} And R says:
Error in db eta (x, alpha, beta): the logic "beta" is missing, no default No I do not understand why R DB does not understand eta (X, alpha, beta). I also tried with db eta (x, size 1 = alpha, size 2 = beta), it does not work, can you help me?
I got the solution to the syntax problem Constropptim function only optimizes the first argument so it works if The customized function is in the form of only one argument.
fit.norm & lt; -function (h) {dist & lt; -function (ab) {diff2 & lt; -Fone (x) (H-x) -norum (x, ab [1], ab [2]) 2 returns (integrated (diff2,0,1) $ value)} res & lt; -constrOptim (theta = cc (0,1), ci = c (0, -1), c (0,1), c = (0,1), c = 1, 0)) returns & lt; -list (res)}
Comments
Post a Comment