Gis and r 007

提供: OSGeo.JP Wiki
2010年12月23日 (木) 00:57時点におけるSay-no (トーク | 投稿記録)による版

移動: 案内検索

表紙へ戻る

※Wiki記法の書き方については http://ja.wikipedia.org/wiki/Help:%E6%97%A9%E8%A6%8B%E8%A1%A8 を参照。


第7回GIS+R勉強会

参加者

  • 清野(リアル)
  • 瀬戸(リアル)
  • 渡邉(リアル)

報告

SDA4PPの公式サイト ( http://ggit.metu.edu.tr/~volkan/index.html ) の各機能の説明文を訳し、それぞれ具体例を示しつつ、自分たちの研究にどう応用するか示す。

瀬戸

清野

SDA4PPの該当ページは以下のとおり。

  • Simulation Envelope of CSR
  • Fit Poisson Model

翻訳中だが、間に合わず。

Simulation Envelope of CSRは量が多かったので、半ばまでの訳で止まっている。

Fit Poisson Modelはその場で翻訳だけはした。以下に貼る。

Poisson Point Process Model (ポワソン点過程モデル)
  • Description (説明)

Creates an instance of the Poisson point process model which can then be fitted to point pattern data.

ポイントパターンデータにフィットできるポワソンポイントプロセスモデルのインスタンスを作る。

  • Usage (使用法)
Poisson()
  • Details (詳細)

The function ppm, which fits point process models to point pattern data, requires an argument interaction of class "interact" describing the interpoint interaction structure of the model to be fitted. The appropriate description of the Poisson process is provided by the value of the function Poisson.

これは、ポイントパターンデータに適合するポイントプロセスモデルであるppm関数で、適合するモデルのインターポイント・インタラクション構造を記述するクラス"interact"のインタラクション引数を求める。ポワソンプロセスの適切な説明はポワソン関数の値として提供されている。

This works for all types of Poisson processes including multitype and nonstationary Poisson processes.

すべてのタイプのポワソンプロセスの作業は、マルチタイプで非定常のポワソンプロセスを含む。

  • Value (値)

An object of class "interact" describing the interpoint interaction structure of the Poisson point process (namely, there are no interactions).

クラス"interact"のオブジェクトはポワソンポイントプロセス(つまりインタラクションはない)のインターポイント・インタラクション構造として記述される。

Simulation Envelope of CSR (CSRのエンベロープシミュレーション)
  • Description(説明)

Computes simulation envelopes of a summary function.

summary()関数のエンベロープシミュレーションを計算する。

  • Usage(利用法)
envelope(Y, fun=Kest, nsim=99, nrank=1, ...,
simulate=NULL, verbose=TRUE, clipdata=TRUE,
start=NULL,control=list(nrep=1e5,expand=1.5),
transform=NULL,global=FALSE,ginterval=NULL, saveall=FALSE,
nsim2=nsim, internal=NULL)
  • Arguments(変数)
    • Y Either a point pattern (object of class "ppp") or a fitted point process model (object of class "ppm").

ポイントパターン("ppp"クラスのオブジェクト)かフィットしたポイントプロセスモデル("ppm"クラスのオブジェクト)を選ぶ変数。

    • fun Function that computes the desired summary statistic for a point pattern.

ポイントパターンのための期待されたsummary統計を計算するための関数。

    • nsim Number of simulated point patterns to be generated when computing the envelopes.

エンベロープを計算する時に生成されるシミュレートされたポイントパターンの数。

    • nrank Integer. Rank of the envelope value amongst the nsim simulated values. A rank of 1 means that the minimum and maximum simulated values will be used.

整数。nsimシミュレート値内のエンベロープ値のランク。ランク1は最小と最大のシミュレート値が用いられたことを意味する。

    • ... Extra arguments passed to fun.

funに渡される追加の変数。

    • simulate Optional. Specifies how to generate the simulated point patterns. If simulate is an expression in the R language, then this expression will be evaluated nsim times, to obtain nsim point patterns which are taken as the simulated patterns from which the envelopes are computed. If simulate is a list of point patterns, then the entries in this list will be treated as the simulated patterns from which the envelopes are computed.

オプション。シミュレートされたポイントパターンをどうやって生成するか指定する。もしシミュレートがR言語内での表現であるならば、計算されたエンベロープからシミュレートされたパターンとして得られたnsimポイントパターンを得るためにnsim回求められる。

    • verbose Logical flag indicating whether to print progress reports during the simulations.

シミュレーション中に進捗状況を表示するかどうかの論理フラグ。

    • clipdata Logical flag indicating whether the data point pattern should be clipped to the same window as the simulated patterns,

before the summary function for the data is computed. This should usually be TRUE to ensure that the data and simulations are properly comparable.

データポイントパターンを、データのsummary()関数を計算する前に、シミュレートされたパターンとして同じウィンドウにクリップするかどうかの論理フラグ。これはデータとシミュレーションが適切に比較できることを保証するために、通常はTRUEである。

    • start,control Optional. These specify the arguments start and control of rmh, giving complete control over the simulation algorithm.

オプション。これらはシミュレーションアルゴリズムの完全な制御を与えるため、rmhのstartとcontrolの変数を指定する。

    • transform Optional. A transformation to be applied to the function values, before the envelopes are computed. An expression object (see Details).

オプション。エンベロープが計算される前に、関数値に適用された変形。

    • global Logical flag indicating whether envelopes should be pointwise (global=FALSE) or simultaneous (global=TRUE).

エンベロープがポイントワイズ(global =FALSE)かサイマルテイニアス(global=TRUE)か指示する論理フラグ。

    • ginterval Optional. A vector of length 2 specifying the interval of r values for the simultaneous critical envelopes. Only relevant if global=TRUE.

オプション。サイマルテイニアスなクリティカルエンベロープのためのr値のインターバルを指定する長さ2のベクトル。global=TRUEの時だけ関連する。

    • saveall Logical flag indicating whether to save all the simulated curves.

全てのシミュレートされた曲線をセーブするかどうか支持する論理フラグ。

    • nsim2 Number of extra simulated point patterns to be generated if it is necessary to use simulation to estimate the theoretical mean of the summary function. Only relevant when global=TRUE and the simulations are not based on CSR.

summary()関数の理論的な意味を評価するためにシミュレーションを使う必要があると考えられた場合に生成された、追加のシミュレートされたポイントパターンの数。global=TRUEでシミュレーションがCSRに基づいていない時にだけ関連する。

    • internal Do not use this argument. It is used by the package's internal code.

この変数は使ってはいけない。パッケージ内のコードに使われている。

  • Details(詳細)

Simulation envelopes can be used to assess the goodness-of-fit of a point process model to point pattern data. See the References.

エンベロープシミュレーションは、ポイントプロセスモデルがポイントパターンデータによく適合する度合を評価するために用いられる。

This function first generates nsim random point patterns in one of the following ways.

この関数は、以下に挙げる方法のうちの一つの、nsimランダムポイントパターンを最初に生成する。

    • If Y is a point pattern (an object of class "ppp") and simulate=NULL, then this routine generates nsim simulations of Complete Spatial Randomness (i.e. nsim simulated point patterns each being a realisation of the uniform Poisson point process) with the same intensity as the pattern Y. (If Y is a multitype point pattern, then the simulated patterns are also given independent random marks; the probability distribution of the random marks is determined by the relative frequencies of marks in Y.)
    • もしYがポイントパターン(クラス”ppp”のオブジェクト)でかつシミュレートがNULLであれば、このルーチンは、同じ強度のパターンYと完全な空間ランダム性(例:nsimシミュレートされたポイントパターンはそれぞれ均等なポワソンポイントプロセスと理解される)のnsimシミュレーションを生成する(もしYがマルチタイプポイントパターンならば、シミュレートされたポイントパターンは独立したランダム点数も与えられる。ランダム点数の確率分布はY内の点数の相対度数によって定義される)。
    • If Y is a fitted point process model (an object of class "ppm") and simulate=NULL, then this routine generates nsim simulated realisations of that model.
    • もしYがフィットしたポイントプロセスモデル(クラス"ppm"のオブジェクト)で、シミュレートがNULLであれば、このルーチンはそのモデルのnsimシミュレートされた認識を生成する。
    • If simulate is supplied, then it determines how the simulated point patterns are generated. It may be either

もしシミュレートが与えられたならば、それはどのようにシミュレートされたポイントパターンが生成されたか定義される。

      • an expression in the R language, typically containing a call to a random generator. This expression will be evaluated nsim times to yield nsim point patterns. For example if simulate=expression(runifpoint(100)) then each simulated pattern consists of exactly 100 independent uniform random points.

それはR言語内での表現でもあり、一般的にはランダム生成の呼び出しを含む。この表現は、nsimポイントパターンが生成されるまでnsim回計算される。例えば、もしsimulate=expression(runifpoint(100))ならば、それぞれのシミュレートされたパターンは正確に100個の独立した均一のランダムポイントから成り立つ。

      • a list of point patterns. The entries in this list wil be taken as the simulated patterns.

ポイントパターンのリスト。このリストのエントリはシミュレートされたパターンから取られる。

The summary statistic fun is applied to each of these simulated patterns. Typically fun is one of the functions Kest, Gest, Fest, Jest, pcf, Kcross, Kdot, Gcross, Gdot, Jcross, Jdot, Kmulti, Gmulti, Jmulti or Kinhom. It may also be a character string containing the name of one of these functions.

summary統計funはこれらのシミュレートされたパターンそれぞれに適用される。一般的にfunはKest, Gest, Fest, Jest, pcf, Kcross, Kdot, Gcross, Gdot, Jcross, Jdot, Kmulti, Gmulti, Jmultiあるいは Kinhom関数の一つである。また、これらの関数名の一つを文字列に含む。

The statistic fun can also be a user-supplied function; if so, then it must have arguments X and r like those in the functions listed above, and it must return an object of class "fv".

統計funはユーザー定義の関数になりえる。もしそうならば、それは上記に列挙した関数同様、変数Xとrを必ず持つ。そしてそれはクラス"fv"のオブジェクトを必ず返す。

Upper and lower critical envelopes are computed in one of the following ways:

上記と下記のクリティカルエンベロープは以下のような方法により計算される。


pointwise(ポイントワイズ):


by default, envelopes are calculated pointwise (i.e. for each value of the distance argument r), by sorting the nsim simulated values, and taking the m-th lowest and m-th highest values, where m = nrank. For example if nrank=1, the upper and lower envelopes are the pointwise maximum and minimum of the simulated values.

デフォルトでは、エンベロープはポイントワイズとして計算され(例えばそれぞれの距離変数rの値)、nsimシミュレートされた値によってソートされ、mがnランクの場合にm-th最小値とm-th最大値をとる。例えば、nランクが1の時は、最大と最小のエンベロープはシミュレートされた値のポイントワイズの最大と最小になる。

The pointwise envelopes are not “confidence bands” for the true value of the function! Rather, they specify the critical points for a Monte Carlo test (Ripley, 1981). The test is constructed by choosing a fixed value of r, and rejecting the null hypothesis if the observed function value lies outside the envelope at this value of r. This test has exact significance level alpha = 2 * nrank/(1 + nsim).

ポイントワイズエンベロープは関数の真の値のための"信頼度帯"ではない!むしろ、それらはモンテカルロテスト(Ripley, 1981)のクリティカルポイントを指示する。このテストはrの固定値を選ぶことで構築され、このr値のエンベロープの外側に、観測された関数値が位置するようであれば、帰無仮説を否定するとになる。このテストは正確な重要度レベルのアルファは2 * nrank/(1 + nsim)である。

simultaneous(サイマルテイニアス):

if global=TRUE, then the envelopes are determined as follows. First we calculate the theoretical mean value of the summary statistic (if we are testing CSR, the theoretical value is supplied by fun; otherwise we perform a separate set of nsim2 simulations, compute the average of all these simulated values, and take this average as an estimate of the theoretical mean value). Then, for each simulation, we compare the simulated curve to the theoretical curve, and compute the maximum absolute difference between them (over the interval of r values specified by ginterval). This gives a deviation value d[i] for each of the nsim simulations. Finally we take the m-th largest of the deviation values, where m=nrank, and call this dcrit. Then the simultaneous envelopes are of the form lo = expected - dcrit and hi = expected + dcrit where expected is either the theoretical mean value theo (if we are testing CSR) or the estimated theoretical value mmean (if we are testing another model). The simultaneous critical envelopes have constant width 2 * dcrit. The simultaneous critical envelopes allow us to perform a different Monte Carlo test (Ripley, 1981). The test rejects the null hypothesis if the graph of the observed function lies outside the envelope at any value of r. This test has exact significance level alpha = nrank/(1 + nsim).

もしglobal=TRUEならば、エンベロープは以下のように定義される。

The return value is an object of class "fv" containing the summary function for the data point pattern, the upper and lower simulation envelopes, and the theoretical expected value (exact or estimated) of the summary function for the model being tested. It can be plotted using plot.fv.

Arguments can be passed to the function fun through .... This makes it possible to select the edge correction used to calculate the summary statistic. See the Examples. Selecting only a single edge correction will make the code run much faster.

If Y is a fitted point process model, and simulate=NULL, then the model is simulated by running the Metropolis-Hastings algorithm rmh. Complete control over this algorithm is provided by the arguments start and control which are passed to rmh.

For simultaneous critical envelopes (global=TRUE) the following options are also useful:

ginterval determines the interval of r values over which the deviation between curves is calculated. It should be a numeric vector of length 2. There is a sensible default (namely, the recommended plotting interval for fun(X)). transform specifies a transformation of the summary function fun that will be carried out before the deviations are computed. It must be an expression object using the symbol . to represent the function value. For example, the conventional way to normalise the K function (Ripley, 1981) is to transform it to the L function L(r) = sqrt(K(r)/pi) and this is implemented by setting transform=expression(sqrt(./pi)). Such transforms are only useful if global=TRUE. It is also possible to extract the summary functions for each of the individual simulated point patterns, by setting saveall=TRUE. Then the return value also has an attribute "savedata" containing all the summary functions for the individual simulated patterns. It is an "fv" object containing functions named sim1, sim2, ... representing the nsim summary functions.

Value

An object of class "fv", see fv.object, which can be plotted directly using plot.fv. Essentially a data frame containing columns

r the vector of values of the argument r at which the summary function fun has been estimated obs values of the summary function for the data point pattern lo lower envelope of simulations hi upper envelope of simulations theo theoretical value of the summary function under CSR (Complete Spatial Randomness, a uniform Poisson point process) if the simulations were generated according to CSR mmean estimated theoretical value of the summary function, computed by averaging simulated values, if the simulations were not generated according to CSR. Additionally, if saveall=TRUE, the return value has an attribute "savedata" which contains the summary functions computed for each of the nsim simulated patterns.

Warning

An error may be generated if one of the simulations produces a point pattern that is empty, or is otherwise unacceptable to the function fun.


渡邉

注意事項

今後の方針

  • SDA4PPサイトの和訳は最低限行なう

次回の予定

1月14日(金)か17日(月)を第一候補。