[R] Partial Likelihood
Ben Bolker
bbolker at gmail.com
Sat Aug 4 21:39:15 CEST 2012
Joshua Wiley <jwiley.psych <at> gmail.com> writes:
>
> In addition to Bert's suggestion of r sig mixed models
> (which I second), I would encourage you to create a
> more detailed example and explanation of what you hope to accomplish.
> Sounds a bit like an auto regressive
> structure, but more details would be good.
>
> Cheers,
>
> Josh
>
> On Aug 4, 2012, at 9:34, Bert Gunter <gunter.berton <at> gene.com> wrote:
>
> > Sounds like generalized linear mixed modeling (glmm) to me. Try
> > posting to the r-sig-mixed-models list rather than here to increase
> > the likelihood of a useful response.
> >
> > -- Bert
> >
> > On Sat, Aug 4, 2012 at 3:55 AM, doctoratza <mammas_k <at> live.com> wrote:
> >> Hello everyone,
> >>
> >> i would like to ask if everyone knows how to perfom a glm partial likelihood
> >> estimation in a time series whrere dependence exists.
> >>
> >> lets say that i want to perform a logistic regression for binary data (0, 1)
> >> with binary responses which a re the previous days.
> >>
> >> for example:
> >>
> >>
> >> logistic<-glm(dat$Day~dat$Day1+dat$Day2, family=binomial(link="logit"))
> >>
> >> where dat$Day (0 or 1) is the current day and dat$Day1 is one day before (0
> >> or 1).
... and presumably Day2 is 2 days before?
> >>
> >> is it possible that R performs partial likelihood estimation automatically?
> >>
> >>
Since it's plausible in this case that the responses are all observed without
error,
I don't necessarily see why you need GLMMs, or anything beyond a regular GLM
fit to do this ... you just need up to set the lagged variables correctly.
As I interpret this question,
dat <- data.frame(Day=c(Day,rep(NA,2)),Day1=c(NA,Day,NA),Day2=c(NA,NA,Day))
glm(Day~Day1+Day2,na.action=na.exclude,data=dat,family=binomial)
should work just fine (na.action=na.exclude isn't really necessary -- the
default behavior is to omit NAs -- but this way if you do something like
predictions it will automatically give you NA values for the beginning and
end of the series).
Autoregression is only hard when the process is observed with error ...
More information about the R-help
mailing list