Displaying 1 result from an estimated 1 matches for "simnew".
Did you mean:
imnew
2012 Feb 21
1
prior.weights and weights()
...## now try na.exclude
g <- glm(y~x,data=d,subset=(f==2),na.action=na.exclude,
family=poisson)
length(fitted(g)) ## 5
length(weights(g)) ## 5
length(g$prior.weights) ## 2
poisson()$simulate(g,1) ## fails
## here's a new, 'safe' version of the Poisson simulate function ...
simnew <- function (object, nsim) {
wts <- weights(object)
if (any(na.omit(wts) != 1))
warning("ignoring prior weights")
ftd <- na.omit(fitted(object))
napredict(na.action(object),
rpois(nsim * length(ftd), ftd))
}
simnew(g,1)