0

このplmモデルの実行に問題があります:

私のデータは(例)です:

    country=c(1,1,1,2,2,2,3,3,3)
    year=c(1,2,3,1,2,3,1,2,3)
    a=c(1,4,6,3,5,8,4,5,7)
    b=c(8,5,7,2,7,4,9,7,1)
    matrix=cbind(country, year, a, b)
    matrix=plm.data(matrix)

次の回帰を実行します。

    reg=plm(a~year+b, data=matrix, index=NULL, model="within")
    summary(reg)

次の警告メッセージが表示されます: [1]

    Warning messages:
    1: In if (is.na(le)) { :
      the condition has length > 1 and only the first element will be used
    2: In if (is.na(le)) " __no length(.)__ " else if (give.length) { :
      the condition has length > 1 and only the first element will be used
    3: In if (le > 0) paste0("[1:", paste(le), "]") else "(0)" :
      the condition has length > 1 and only the first element will be used

なにが問題ですか?

4

2 に答える 2

1

私は同じ問題を抱えていて、答えを見つけました(here

この警告は、次のようなベクトルの場合に発生します。

le<-c(4,2,6,5)

次のようなテストで使用されます。

if(is.na(le)) ...

R は、テストのベクトルの最初の値のみを調べますが、テストされていない他の値があったことを警告します。テストが次の場合:

if(is.na(le[1]))

"le" の値が 1 つだけか複数であるかは関係なく、警告は表示されません。通常、何も混乱しません。

于 2014-04-15T16:27:00.830 に答える