Re: [R] R-help Digest, Vol 185, Issue 1

2018-07-03 Thread Nina Schönfelder
Dear Luke,

it true that the number is not immediately displayed in the 
GMM-regression output using the plm package. To get the number of 
instruments (incl. exogenous variables and time dummies) you have to type:

   k <- model    # so that k is the pgmm-estimation output (an 
object of class c("pgmm","panelmodel")
       ninst <- ncol(k$W[[1]])    # the number of instruments is simply 
count as the number of columns in the matrix of instruments

Best regards,

Nina

--

*Dr. Nina Schönfelder*

*Nationaler Open-Access-Kontaktpunkt OA2020-DE*
Universität Bielefeld
Universitätsbibliothek
Universitätsstr. 25
D-33615 Bielefeld

Phone: +49 (0) 521/106-2546
E-mail: nina.schoenfel...@uni-bielefeld.de
Homepage: https://oa2020-de.org/
Twitter: @oa2020de
Facebook: https://www.facebook.com/oa2020de/

Am 01.07.2018 um 12:00 schrieb r-help-requ...@r-project.org:
> Message: 1
> Date: Sat, 30 Jun 2018 11:03:06 +0200
> From: =?UTF-8?b?xYF1a2FzeiBQacSZdGFr?=
> To:r-help@r-project.org
> Subject: [R] Question
> Message-ID: 
> Content-Type: text/plain; charset="utf-8"
>
>
> Hi, My name is Luke and I come from Poland. I have one question, maybe very 
> simple, but I can not resolve it. In dynamic panel data (GMM estimator) after 
> running the model, I recieve a AR test and Sargan test, but the "number of 
> instruments" are not displayed. In Stata and Gretl this informatios is given, 
> in R no. My question is, how to obtain the number of instruments?.
> Thank you for helping.
> Luke
>
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] issues in plm using random effect model

2017-06-12 Thread Nina Schönfelder

Dear Kailas Gokhale,

The negative individual variance is not a problem with your code or plm. 
It a property of your data. Please check the posts of Giovanni Millo on 
this topic:


[R] R: plm random effect: the estimated variance of the individual 
effect is negative

Millo Giovanni Giovanni_Millo at Generali.com
Sat Jan 5 10:10:01 CET 2013

You can find the posts in the archive by rseek.org.

Kind regards,

Nina Schönfelder

-
FernUniversität in Hagen
Fakultät für Wirtschaftswissenschaft
Lehrstuhl für Volkswirtschaftslehre,
insbes. Makroökonomik
58084 Hagen

E-Mail: nina.schoenfel...@fernuni-hagen.de
Telefon: +49 2331 987 - 2379
Fax: +49 2331 987 - 391

Hausanschrift:
Informationszentrum (IZ, ehemals TGZ)
Universitätsstr. 11
Raum B110

Am 06.06.2017 um 12:00 schrieb r-help-requ...@r-project.org:

Message: 1
Date: Mon, 5 Jun 2017 15:41:23 +0530
From: Kailas Gokhale
To:r-help@r-project.org
Subject: [R] issues in plm using random effect model
Message-ID:

Content-Type: text/plain; charset="UTF-8"

Dear Sir,

Thank you for accepting my request for registration on this site.
I am trying to solve panel data problems using plm package , but while
suing random effect model i am getting following messege saying
"

Warning message:In sqrt(sigma2) : NaNs produced

"

In some other cases i am getting message saying where TSS = NA , that I am
not understanding
I am sending you my code along with out put.

Kindly help me .

I am sending you my code and output for your kind reference. data file is
also attached


rm(list=ls())
library(MASS)
library(bdsmatrix)
library(zoo)
library(nlme)
library(sandwich)
library(car)
library(lmtest)
library(plm)

data1<- read.csv(file.choose(),header=TRUE,sep=",")
D<-na.omit(data1)
attach(D)
Pdata<-plm.data(D, index=c("CT","T"))

pool11<- plm(Y~X1+X2,data = Pdata, model="pooling")
# pool21<- plm(Equity.dividend.1~ Profit.after.tax.1+ LaggedDivd.1+
log(Size.1)+factor(CompanyName)-1,data = Pdata, model="pooling")
fixed.mod1<- plm(Y~X1+X2,data = Pdata, model="within")
rand.mod1<- plm(Y~X1+X2,data = Pdata, model="random")


summary(pool11)
summary(fixed.mod1)
summary(fixef(fixed.mod1))
summary(rand.mod1)


##output

Oneway (individual) effect Pooling Model

Call:
plm(formula = Y ~ X1 + X2, data = Pdata, model = "pooling")

Unbalanced Panel: n=6, T=4-6, N=34

Residuals :
Min. 1st Qu.  Median 3rd Qu.Max.
-19.400  -9.810  -0.648   8.490  23.900

Coefficients :
  Estimate Std. Error t-value  Pr(>|t|)
(Intercept) 25.229162   6.858418  3.6786 0.0008847 ***
X1   0.016438   0.046905  0.3504 0.7283744
X2  -2.231250   2.220346 -1.0049 0.3227198
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1

Total Sum of Squares:5082
Residual Sum of Squares: 4892.7
R-Squared:  0.037241
Adj. R-Squared: 0.033955
F-statistic: 0.599566 on 2 and 31 DF, p-value: 0.55529>
summary(fixed.mod1)Oneway (individual) effect Within Model

Call:
plm(formula = Y ~ X1 + X2, data = Pdata, model = "within")

Unbalanced Panel: n=6, T=4-6, N=34

Residuals :
 Min.  1st Qu.   Median  3rd Qu. Max.
-24.  -8.0400  -0.0795   6.6300  25.1000

Coefficients :
 Estimate Std. Error t-value Pr(>|t|)
X1  0.065306   0.060090  1.0868   0.2871
X2 -3.082215   2.514602 -1.2257   0.2313

Total Sum of Squares:4791.9
Residual Sum of Squares: 4380.7
R-Squared:  0.085822
Adj. R-Squared: 0.065628
F-statistic: 1.22042 on 2 and 26 DF, p-value: 0.31146>
summary(fixef(fixed.mod1))  Estimate Std. Error t-value  Pr(>|t|)
A  33.267210.4360  3.1877 0.0014340 **
B  21.9300 9.2930  2.3598 0.0182831 *
C  27.6590 7.9522  3.4781 0.0005049 ***
D  21.9369 9.4271  2.3270 0.0199647 *
E  17.6243 8.6149  2.0458 0.0407766 *
F  23.8578 9.2198  2.5877 0.0096625 **
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1>
summary(rand.mod1)Oneway (individual) effect Random Effect Model
(Swamy-Arora's transformation)

Call:
plm(formula = Y ~ X1 + X2, data = Pdata, model = "random")

Unbalanced Panel: n=6, T=4-6, N=34

Effects:
  var std.dev  share
idiosyncratic 168.49   12.98  1.117
individual-17.60  NA -0.117
theta  :
Min. 1st Qu.  MedianMean 3rd Qu.Max.
-0.6366 -0.6366 -0.6366 -0.5983 -0.6366 -0.3106

Residuals :
Min. 1st Qu.  MedianMean 3rd Qu.Max.
-21.000 -11.400   0.913   0.114   9.040  24.000

Coefficients :
   Estimate Std. Error t-value  Pr(>|t|)
(Intercept) 26.3963638  6.5706835  4.0173 0.0003482 ***
X1  -0.0066621  0.0433425 -0.1537 0.8788364
X2  -2.1087903  2.1533566 -0.9793 0.3350111
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1

Total Sum of Squares:5548.4
Residual Sum of Squares: 5382.1
R-Squared:  0.03713

Re: [R] plm function & plm r.squared error

2015-02-17 Thread Nina Schönfelder

Dear Constanze,

the error message gives you a hint, where the problem might be. The 
first error massage says that you have NAs in your index variables 
"Unit" and "Week". You can check that with the is.na() function. The 
second error message (r.squared) tells you to specify the model, that is 
on which transformation of the data the R-squared has to be computed.  
There is no default. Moreover, you insert a dataframe ("pCN04") instead 
on a plm object in r.squared().


Kind regards

Nina Schönfelder

-
FernUniversität in Hagen
Fakultät für Wirtschaftswissenschaft
Lehrstuhl für Volkswirtschaftslehre,
insbes. Makroökonomik
58084 Hagen


On 16/02/15 22:25, fay constanze wrote:

DearGiovanni,Congratulationsfor the?truly helpful?plm package! Being new to R, I have a problem with the plm 
function for financial markets timeseries data: After having defined a large, unbalanced panel pdata.frame 
(https://www.dropbox.com/s/2r9t1cu9v65gobk/Database_CN_2004.csv?dl=0)and running a simple OLS model of two 
variables regressing company returns(Perf) on index returns (PerfIn)synch <-plm (Perf ~ PerfIn , data=pCN04, 
na.action = na.omit, index=c("Unit", "Week"), model="pooling") I keepreceiving the 
following error:Error in model.matrix.pFormula(formula, data, rhs =1, model = model,? : ? NA in theindividual 
index variableIn addition:Warning message:In `[.data.frame`(index, as.numeric(rownames(mf)),) :? NAsintroduced 
by coercion
There aremuch more NAs in y (Perf) than in x (PerfIn) and I have tried to get rid ofthem 
with na.omit. Another error I have is with the same model for the r.squaredfunction 
r.squared(pCN04,model=NULL, Perf ~ PerfIn, type= "ess")Error in 
tss.default(object, model = model) : ??unused argument (model = model)In addition: 
Warning message:In mean.default(haty) : argument is not numeric or logical: returning 
NAMany thanks in advance,your help is very precious to me!Constanze




__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.