[R] Dynamic random effects model

2009-01-28 Thread Joseph Magagnoli
All R experts,
How do I fit a dynamic Random effects model with a binary dependent variable
in R
Thanks
JCM

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


Re: [R] Dynamic random effects model

2009-01-29 Thread Joseph Magagnoli
I am trying to estimate a model of third party intervention into civil war.
The data is panel data structure.  The unit of analysis
is civil war year.  For each civil war year my dependent variable is coded
0=no intervention and 1=intervention.  I want to use a
lagged dependent variable as an independent variable and i am including
other variables such as type of war conventional=0,1 dummy
irregular 0,1 dummy,,, other dummy variables such as cold war period, and
other variables such as state strength .   Some of my independent variables
are time invariant or slow moving.   Because i want to include lagged
dependent variable rules out a fixed effect,
therefore I was thinking of using random effects.Any suggestion on how
to model this?

I am inexperienced with these models, I will appreciate any help I can get

Thank you

jcm

On Thu, Jan 29, 2009 at 8:04 AM, Ben Bolker  wrote:

>  Joseph Magagnoli  gmail.com> writes:
>
> >
> > All R experts,
> > How do I fit a dynamic Random effects model with a binary dependent
> variable
> > in R
> > Thanks
> > JCM
> >
>
>  You haven't given us nearly enough information to go on.
> If you're talking about something like a state-space model with
> a binary response, I would probably say your best bet is
> a Bayesian approach, prob. via JAGS/R2jags or WinBUGS/R2WinBUGS.
> (A lot) more context will give a higher probability of a useful
> answer.
>
>  good luck
>Ben Bolker
>
> __
> 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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>

[[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] glm package

2009-02-06 Thread Joseph Magagnoli
Hi all,
can the glm package be used to estimate a logit model to panel data?  I am
asking this
because stata has a standard logit model and then an xtlogit for
longitudinal data.  Is there something
similar in R?
Thank you
jcm

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


Re: [R] installing R on Ubuntu

2009-02-08 Thread Joseph Magagnoli
When I use ubuntu linux and R I use komodo edit with an R extension.   Seems
really similar to tinn-R.
http://www.sciviews.org/SciViews-K/index.html

joe

On Sun, Feb 8, 2009 at 8:56 AM, Paul Heinrich Dietrich <
paul.heinrich.dietr...@gmail.com> wrote:

>
> Amendment/Question #1:
>
> When I update.packages(), it tells me that rgl fails to update because it
> can't find X11.  Again, I'm pretty new to Ubuntu, but it looks like X comes
> with Ubuntu.  I see files under /etc/X11.  Does this mean I need to
> download
> x11-common (or x11-apps, or x11-utils, or one of the others?) with the
> Synaptic Package Manager?  I hesitate on this because it seems like X11 is
> not a simple add-on package, but something core to Ubuntu.  Any help is
> appreciated.  Thanks.
> --
> View this message in context:
> http://www.nabble.com/installing-R-on-Ubuntu-tp10025949p21899658.html
>  Sent from the R help mailing list archive at Nabble.com.
>
> __
> 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.
>

[[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] negative binomial predicted probabilities

2008-11-07 Thread Joseph Magagnoli
I estimated a negative binomial model using zelig.
z.out<- zelig(NEWBHC~ PW80 + CHNGBLK + XBLK,data=data, model="negbin")

How do I calculate predicted probabilities for this model?  Is it the same
process as a poisson regression?
Thanks in advance
Joe

[[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] log likelihood

2008-11-21 Thread Joseph Magagnoli
Hi all,
I ran a Weibull model, and I am wondering if  there is any way to extract
the log likelihood.  I tried loglik(model)  but it does not seem to work
any help would be greatly appreciated
joe

[[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] log likelihood

2008-11-21 Thread Joseph Magagnoli
Hi all,
I ran a Weibull model, and I am wondering if  there is any way to extract
the log likelihood.  I tried loglik(model)  but it does not seem to work
any help would be greatly appreciated
joe

[[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] [R} Expected Percent Correctly Predicted (ePCP)

2008-11-23 Thread Joseph Magagnoli
Hi all,
I ran a logit model and I would like to calculate the ePCP.  The problem is
that I have missing data and I cant calculate the ePCP.  Does anyone know
how to calculate this with missing data?  here are the codes I used-but I
guess it only works  when the data is complete


###Model 2
#1 estimate the model
logit2<-zelig(inter~conv + asym + lnbdeadbest + strength + numgrps + durest
+ cap + border + coldwar + ethnic + govt + mixedaim+  lmtnest + polity2 +
lamerica + ssafrica + asia + nafrme, model="logit",data=data)

#2 record the coefficients and variance-covarnaicne matrix
coeff <- logit2$coefficients
covar <- vcov(logit2)

#3 simulate the coefficients vector and variance matrix
simcoef <- rmvnorm(n=1000, mean=coeff, sigma=covar)

#4 compute the predicted probabilities
sphat <- invlogit(cbind(1, conv, asym, lnbdeadbest, strength, numgrps,
durest, cap, border, coldwar, ethnic, govt, mixedaim, lmtnest, polity2,
lamerica, ssafrica, asia, nafrme ) %*% t(simcoef))

#5 compute ePCP
n <- nrow(data)
sump <- matrix(NA, 1000, n)
sump[inter==1] <- sphat[inter==1]
sump[inter==0] <- 1-sphat[inter==0]
ePCP2 <- (1/1000) * colSums(sump)
hist(ePCP2)
quantile(ePCP2, c(0.025, 0.975))

[[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] [R} seasonal differencing

2009-04-02 Thread Joseph Magagnoli
Hi all,
I was wondering how to construct a seasonal differenced time series
variable.
I used the following code to construct a 12 span seasonal difference

seasonal<-diff(V2, lag=12, differences=1)

is this correct?

thank you in advance
joe

[[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] arma model with garch errors

2009-04-29 Thread Joseph Magagnoli
Dear R experts,
I am trying to estimate an ARMA 2,2 model with garch errors.
I used the following code on R 2.9.

#library
library(fGarch)
#data
data1<-ts(read.table("C:/Users/falcon/Desktop/Time
Series/exports/goods1.csv"), start=c(1992,1), frequency=12)
head(data1)

#garch
garchFit(formula.mean= ~arma(2,2),formula.var=~garch(1,1), data=data1)
but get this error:

> garchFit(formula.mean= ~arma(2,2),formula.var=~garch(1,1), data=data1)
Error in garchFit(formula.mean = ~arma(2, 2), formula.var = ~garch(1,  :
  element 1 is empty;
   the part of the args list of 'length' being evaluated was:
   (formula)

what am I doing wrong?   any help would be greatly appreciated
joe

[[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] Generating a count variable

2009-06-01 Thread Joseph Magagnoli
Dear All,
I am practicing data manipulation and I would like to generarte a count
variable.  My data looks like this:


Country   MID
   1  NA
   10
   10
   11
   10
   20
   21
   20
   20
   20

I would like to to generate a variable that counts the periods of zeros in
the MID variable for each country for example:
 Country   MIDCount
   1  NA
   101
   102
   110
   101
   201
   210
   201
   202
   203
I am used to doing my data manipulation in stata but I want to try learn to
do it in R.

Thank you for your help
joe

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


Re: [R] Most used R editors

2009-06-02 Thread Joseph Magagnoli
on windows I use Rwinedt, and under linux I use  SciViews-k (
http://www.sciviews.org/SciViews-K/index.html),
works well for me
joe



On Tue, Jun 2, 2009 at 9:44 AM, Ronggui Huang wrote:

> Yes, Tinn-R is great for windows users. However, if you work under
> different OS, it would be great to have an OS-independent editor.
>
> Ronggui
>
> 2009/6/2 Bos, Roger :
> > I have not seen Tinn-R mentioned so I will mention it.  Its worked great
> for me.  Eclipse is a nice IDE, but its more complicated that what is
> necessary for R programming.
> >
> >
> > -Original Message-
> > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Martial Sankar
> > Sent: Tuesday, June 02, 2009 3:06 AM
> > To: rhelp
> > Subject: [R] Most used R editors
> >
> >
> > Hi,
> >
> > I am a little lonely as R users in my group. So, I would like to know
> which editor is the most used in the R community.
> > This post is some kind of survey.
> >
> > Personally, I use  Emacs with ESS, It permits to :
> >
> > - open more than one R session
> > - split the emacs editor as many part as you want.
> > - use a lot of keybindings.
> > ...
> >
> > I also tried Rkwards, Scilab (windows), JGR etc... but they are not
> suitable for what I do.
> >
> > Best,
> >
> > - Martial
> >
> >
> > _
> > Découvrez toutes les possibilités de communication avec vos proches
> >
> >[[alternative HTML version deleted]]
> >
> >
> > ** *
> > This message is for the named person's use only. It may
> > contain confidential, proprietary or legally privileged
> > information. No right to confidential or privileged treatment
> > of this message is waived or lost by any error in
> > transmission. If you have received this message in error,
> > please immediately notify the sender by e-mail,
> > delete the message and all copies from your system and destroy
> > any hard copies. You must not, directly or indirectly, use,
> > disclose, distribute, print or copy any part of this message
> > if you are not the intended recipient.
> >
> > __
> > 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.
> >
>
>
>
> --
> HUANG Ronggui, Wincent
> PhD Candidate
> Dept of Public and Social Administration
> City University of Hong Kong
> Home page: http://asrr.r-forge.r-project.org/rghuang.html
>
> __
> 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.
>

[[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] kaplan-meier error

2009-07-21 Thread Joseph Magagnoli
Hi all, 
I am getting an error in my code and I don't know what the problem is.
I am using R 2.9 on ubuntu.   my code is as follows:

## Libraries ##
library(survival)
library(foreign)

## reading data ##

data<-read.dta("http://psfaculty.ucdavis.edu/bsjjones/cabinet.dta";)
head(data)
attach(data)


fit1<-survfit(Surv(durat,censor))
and I get the following error 
> fit1<-survfit(Surv(durat,censor))
Error in survfit(Surv(durat, censor)) :
  Survfit requires a formula or a coxph fit as the first argument
any help is greatly appreciated 
Joe

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