R備忘録 - 記事一覧
- 投稿者: みゅ
- カテゴリ: なし
- 優先度: 普通
- 状態: 完了
- 日時: 2010年01月10日 16時25分03秒
double dnorm(double x, double mu, double sigma, int give_log);
double pnorm(double x, double mu, double sigma, int lower_tail, int give_log);
double qnorm(double p, double mu, double sigma, int lower_tail, int log_p);
double rnorm(double mu, double sigma);
- For reference, the following table gives the basic name (to be prefixed by ‘d’, ‘p’, ‘q’ or ‘r’ apart from the exceptions noted) and distribution-specific arguments for the complete set of distributions.
beta beta a, b
non-central beta nbeta a, b, ncp
binomial binom n, p
Cauchy cauchy location, scale
chi-squared chisq df
non-central chi-squared nchisq df, ncp
exponential exp scale (and not rate)
F f n1, n2
non-central F nf n1, n2, ncp
gamma gamma shape, scale
geometric geom p
hypergeometric hyper NR, NB, n
logistic logis location, scale
lognormal lnorm logmean, logsd
negative binomial nbinom size, prob
normal norm mu, sigma
Poisson pois lambda
Student’s t t n
non-central t nt df, delta
Studentized range tukey (*) rr, cc, df
uniform unif a, b
Weibull weibull shape, scale
Wilcoxon rank sum wilcox m, n
Wilcoxon signed rank signrank n
double gammafn (double x) [Function]
double lgammafn (double x) [Function]
double digamma (double x) [Function]
double trigamma (double x) [Function]
double tetragamma (double x) [Function]
double pentagamma (double x) [Function]
double psigamma (double x, double deriv) [Function]
- The Gamma function, the natural logarithm of its absolute value and first four derivatives and the n-th derivative of Psi, the digamma function.
double beta (double a, double b) [Function]
double lbeta (double a, double b) [Function]
- The (complete) Beta function and its natural logarithm.
double choose (double n, double k) [Function]
double lchoose (double n, double k) [Function]
- The number of combinations of k items chosen from from n and its natural logarithm. k is rounded to the nearest integer (with a warning if needed).
double bessel_i (double x, double nu, double expo) [Function]
double bessel_j (double x, double nu) [Function]
double bessel_k (double x, double nu, double expo) [Function]
double bessel_y (double x, double nu) [Function]
- Bessel functions of types I, J, K and Y with index nu. For bessel_i and bessel_k there is the option to return exp(-x) I(x; nu) or exp(x) K(x; nu) if expo is 2. (Use expo == 1 for unscaled values.)
- optimが元となるCコードに直接アクセスすることができる.ユーザーは最小化したい関数を次の定義で与える必要がある.
typedef double optimfn(int n, double *par, void *ex);
- 1番目のパラメータは2番目のパラメータで与える変数の数である.The third argument is a pointer passed down from the calling routine, normally used to carry auxiliary information.
- いくつかの方法では以下の微係数も必要になる.
typedef void optimgr(int n, double *par, double *gr, void *ex);
- これはgr引数を通じて(微係数が)返される.No function is provided for finite-differencing, nor for approximating the Hessian at the result.
- インターフェース(ヘッダーファイル‘R_ext/Applic.h’で定義されている)は
- Nelder Mead:
void nmmin(int n, double *xin, double *x, double *Fmin, optimfn fn,
int *fail, double abstol, double intol, void *ex,
double alpha, double beta, double gamma, int trace,
int *fncount, int maxit);
void vmmin(int n, double *x, double *Fmin,
optimfn fn, optimgr gr, int maxit, int trace,
int *mask, double abstol, double reltol, int nREPORT,
void *ex, int *fncount, int *grcount, int *fail);
void cgmin(int n, double *xin, double *x, double *Fmin,
optimfn fn, optimgr gr, int *fail, double abstol,
double intol, void *ex, int type, int trace,
int *fncount, int *grcount, int maxit);
- Limited-memory BFGS with bounds:
void lbfgsb(int n, int lmm, double *x, double *lower,
double *upper, int *nbd, double *Fmin, optimfn fn,
optimgr gr, int *fail, void *ex, double factr,
double pgtol, int *fncount, int *grcount,
int maxit, char *msg, int trace, int nREPORT);
void samin(int n, double *x, double *Fmin, optimfn fn, int maxit,
int tmax, double temp, int trace, void *ex);
- 多くの引数が複数のタイプの手法で共通である.nはパラメーター(訳者 注:changing variablesのこと)xの数である.xinはxの初期値であり、xに最終結果がセットされて戻ってくる.また関数の最終の値がFminにセットされる.他のパラメーターの説明は関数「optim」のヘルプページで見つかるだろう.nbdの値についてはソースコード「src/appl/lbfgsb.c」を見よ.そこにはどのような境界が使われるかを特定している.
typedef void integr_fn(double *x, int n, void *ex);
- There are interfaces (defined in header ‘R_ext/Applic.h’) for definite and for indefinite integrals. ‘Indefinite’ means that at least one of the integration boundaries is not finite.
- Finite:
void Rdqags(integr_fn f, void *ex, double *a, double *b,
double *epsabs, double *epsrel,
double *result, double *abserr, int *neval, int *ier,
int *limit, int *lenw, int *last,
int *iwork, double *work);
void Rdqagi(integr_fn f, void *ex, double *bound, int *inf,
double *epsabs, double *epsrel,
double *result, double *abserr, int *neval, int *ier,
int *limit, int *lenw, int *last,
int *iwork, double *work);
R備忘録 /状態空間モデリング/donlp2/その他のメモ