[R] coeftest with covariance matrix

2017-03-16 Thread alfonso . carfora

Hi all,


I want to ask you which is the difference between the specifyng and  
not specifyng the covariance matrix of the estimated coefficients when  
performing the coeftest command.


I'm estimating a VECM model and I want to test the significance of the  
short-run casual effects of the explanatory variables:


mod<-cajorls(ca.jo(data[,4:6], ecdet = "const", type="eigen", K=2,  
spec="longrun"))$rlm


The command:

coeftest(mod)

give me different results with respect to this one:

V<-vcovHC(mod)
coeftest(mod,V)

__
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.


[R] splm package: Spatial weights matrix of the 103 Italian provinces

2014-09-22 Thread alfonso . carfora

Hello,

I'm using the spatial weights matrix of the 103 Italian provinces  
"itaww" of the package splm

example:

library(splm)

data(itaww)

itaww

It is a matrix of 103 rows and 103 columns. Each row (and each column)  
corresponds to an italian province and I would like to know the row's  
names of the matrix (currently defined by numeric ID).


Thank you for your help

Alfonso





**  
IL MERITO DEGLI STUDENTI VIENE RICONOSCIUTO

Il 5 per mille all'Universita' degli Studi di Napoli "Parthenope" incrementa le 
borse di studio agli studenti - codice fiscale 80018240632
http://www.uniparthenope.it/index.php/5xmille 


Questa informativa e' inserita in automatico dal sistema al fine esclusivo 
della realizzazione dei fini istituzionali dell'ente.

__
R-help@r-project.org mailing list
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.


[R] pglm: probit random model

2014-03-21 Thread alfonso . carfora

Hi all,

I'm using pglm package to estimate a static random probit model of the type:

Yi,t = B1X1i,t-k +... + BzXzi,t-k + Ci+ Ui,t

Where Yi={0,1} and all explenatory variables are continuous.

the function I use is:

pglm(formula,, Data, family = binomial(probit), model =  
"random",method= "bfgs")



Can I test the exogeneity and zero correlation between the explanatory  
variables and ci? Or the function carries in an approach (as  
Mundlak-Chamberlain) to overcome the endogeneity between regressors  
and effects?


Thanks
Alfonso

__
R-help@r-project.org mailing list
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.


[R] resdiuals of random model estimated by plm function

2013-11-06 Thread alfonso . carfora

Hi all,


I have estimated a random panel model using plm function.

I have a question about the vector of resduals obtained with the  
object $residuals.


example:

data("Produc", package = "plm")
zz <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp,  
model="random", data = Produc, index = c("state","year"))


res<-zz$residuals # vector of the residuals.

the vector res is the sum of the idyosiyncratic (eit) and individual  
(ui) component or is only the idyosiyncratic (eit) component?


Thanks
Alfonso

__
R-help@r-project.org mailing list
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.


[R] theta parameter - plm package

2013-09-09 Thread alfonso . carfora

Hi all,

what indicates the parameter theta in the summary of a random effect  
panel model estimated with the plm function?


example:

data("Produc", package = "plm")
zz <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp,  
model="random", data = Produc, index = c("state","year"))


summary(zz)

Effects:
   var  std.dev share
idiosyncratic 0.001454 0.038137 0.175
individual0.006838 0.082691 0.825

theta:  0.

Thanks
Alfonso

__
R-help@r-project.org mailing list
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] truncation and approximation

2013-07-18 Thread alfonso . carfora

Maybe you can use "round" and "trunc" functions

For example if you have a vector like this:


x<- c(3.000 3.125 3.250 3.375 3.500 3.625 3.750 3.875 4.000)

and you want to round the numbers to 2 decimals you can use:


round(x,2)

[1] 3.00 3.12 3.25 3.38 3.50 3.62 3.75 3.88 4.00


if you want a numeric vector containing the integers formed by  
truncating the values in x



trunc(x)

[1] 3 3 3 3 3 3 3 3 4

I'hope it'is useful to you
A.C.




Def. Quota Rui Barradas :


Hello,

As for truncation, you can write a one line function:

dec_trunc <- function(x, digits = 0) trunc(x * 10^digits)/10^digits


As for approximation, maybe you're looking for ?signif.

Hope this helps,

Rui Barradas

Em 17-07-2013 18:41, Francesco Miranda escreveu:
What is the function to do the truncation to a certain decimal  
digit of a number. And the function approximation?

Thanks.
Francesco M
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.



__
R-help@r-project.org mailing list
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.





**  
IL MERITO DEGLI STUDENTI VIENE RICONOSCIUTO

Il 5 per mille all'Universita' degli Studi di Napoli "Parthenope" incrementa le 
borse di studio agli studenti - codice fiscale 80018240632
http://www.uniparthenope.it/index.php/5xmille 


http://www.uniparthenope.it/index.php/it/avvisi-sito-di-ateneo/2943-la-parthenope-premia-il-tuo-voto-di-diploma-ed-il-tuo-imegno-con-i-proventi-del-5-per-mille

Questa informativa e' inserita in automatico dal sistema al fine esclusivo 
della realizzazione dei fini istituzionali dell'ente.

__
R-help@r-project.org mailing list
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.


[R] x-labels in barplots

2013-06-25 Thread alfonso . carfora

Hi,

I need to generate a barplot in in which the x-labels must to be  
perpendiculars to the x-axis


in my data have a list of probability values correspondings to a list  
of Countries. In the barplot the name of each Country,  under each  
bar, appears parallel to the x axis. Is possibile rotate them so as to  
make them perpendicular to the x-axis


barplot(fig1$Prob,names.arg=fig1$Country,ylab="probabilities",ylim=c(0,0.3))

Thanks
A.C.



**  
IL MERITO DEGLI STUDENTI VIENE RICONOSCIUTO

Il 5 per mille all'Universita' degli Studi di Napoli "Parthenope" incrementa le 
borse di studio agli studenti - codice fiscale 80018240632
http://www.uniparthenope.it/index.php/5xmille 


http://www.uniparthenope.it/index.php/it/avvisi-sito-di-ateneo/2943-la-parthenope-premia-il-tuo-voto-di-diploma-ed-il-tuo-imegno-con-i-proventi-del-5-per-mille

Questa informativa e' inserita in automatico dal sistema al fine esclusivo 
della realizzazione dei fini istituzionali dell'ente.

__
R-help@r-project.org mailing list
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.


[R] maxLik: different estimations from different packages

2013-05-10 Thread alfonso . carfora

Dear all,

we are computing maximum likelihood estimations using maxLik package  
and we realized that the results of the estimation depend on the  
version of the package installed


for example if we try to estimate this function with an old version of  
maxLik under R 2.13.1 (32 bit version installed 2 years ago):



L<-function (param) {b0t<-param[1]
 p1t<-param[2]
 p2t<-param[3]
 p3t<-param[4]
 p4t<-param[5]

for(i in 17:T) {n[i,]<- b0t + p1t*a[i-1] + p2t*sum(a[(i-4):(i-1)]) +  
p3t*(sum(a[(i-8):(i-1)])) + p4t*(sum(a[(i-16):(i-1)]))

   m[i,]<-exp(n[i])/(1+exp(n[i]))
   ll[i-16,]<-a[i]*log(m[i])+(1-a[i])*log(1-m[i]) }
 sum(ll)}
b2<-maxLik(L, start=c(-2.8158,5,-1,0.3213,-0.3112))


we obtain this results:

summary(b2)

Maximum Likelihood estimation
Newton-Raphson maximisation, 16 iterations
Return code 2: successive function values within tolerance limit
Log-Likelihood: -38.11285
5  free parameters
Estimates:
  Estimate Std. error t value   Pr(> t)
[1,]  -2.815780.43548 -6.4660 1.007e-10 ***
[2,]  50.50024   13.17046  3.8344 0.0001259 ***
[3,] -11.533443.31075 -3.4836 0.0004947 ***
[4,]   0.321300.42978  0.7476 0.4547096
[5,]  -0.311210.23245 -1.3388 0.1806280
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1


NB: a is a binary time series

if we try to estimate the same function using the last version of  
maxLik under R.3.0 (64 bit latest version) the estimation do not  
converge and this is the error message:


Iteration 15
Parameter:
[1]  -2.8146429  51.3042554 -11.7373313   0.3245214  -0.3125767
Gradient:
[1] NaN NaN NaN NaN NaN
Errore in maxNRCompute(fn = logLikAttr, fnOrig = fn, gradOrig = grad, 
hessOrig = hess,  :

  NA in gradient

What causes this?

Thanks
Alfonso





**  
IL MERITO DEGLI STUDENTI VIENE RICONOSCIUTO

Il 5 per mille all'Universita' degli Studi di Napoli "Parthenope" incrementa le 
borse di studio agli studenti - codice fiscale 80018240632
http://www.uniparthenope.it/index.php/5xmille 


http://www.uniparthenope.it/index.php/it/avvisi-sito-di-ateneo/2943-la-parthenope-premia-il-tuo-voto-di-diploma-ed-il-tuo-imegno-con-i-proventi-del-5-per-mille

Questa informativa e' inserita in automatico dal sistema al fine esclusivo 
della realizzazione dei fini istituzionali dell'ente.

__
R-help@r-project.org mailing list
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.


[R] pglm package: fitted values and residuals

2013-04-24 Thread alfonso . carfora

I'm using the package pglm and I'have estimated a "random probit model".
I need to save in a vector the fitted values and the residuals of the  
model but I can not do it.


I tried with the command fitted.values using the following procedure  
without results:


library(pglm)

m1_S<-pglm(Feed ~ Cons_PC_1 + imp_gen_1 + LGDP_PC_1 + lnEI_1 +  
SH_Ren_1,data,family=binomial(probit),model="random",method="bfgs",index=c("Year","IDCountry"))


m1_S$fitted.values
residuals(m1)


Can someone help me about it?

Thanks


**  
IL MERITO DEGLI STUDENTI VIENE RICONOSCIUTO

Il 5 per mille all'Universita' degli Studi di Napoli "Parthenope" incrementa le 
borse di studio agli studenti - codice fiscale 80018240632
http://www.uniparthenope.it/index.php/5xmille 


http://www.uniparthenope.it/index.php/it/avvisi-sito-di-ateneo/2943-la-parthenope-premia-il-tuo-voto-di-diploma-ed-il-tuo-imegno-con-i-proventi-del-5-per-mille

Questa informativa e' inserita in automatico dal sistema al fine esclusivo 
della realizzazione dei fini istituzionali dell'ente.

__
R-help@r-project.org mailing list
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.