Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pooled results differ from Zelig 3.5 #44

Open
whatever opened this issue Jan 28, 2013 · 1 comment
Open

pooled results differ from Zelig 3.5 #44

whatever opened this issue Jan 28, 2013 · 1 comment
Assignees
Labels

Comments

@whatever
Copy link
Contributor

Pooled results work differently than in Zelig 3.5. This needs both a tweak and a documentation change

 library(Zelig)
 obs <- 1000
 dat <- data.frame(cbind(rnorm(obs), runif(obs)))
 names(dat) <- c("myX1", "myX2")

 dat$myY <- dat$myX1 + 2*dat$myX2 - dat$myX1*dat$myX2 + rnorm(obs)

 m1 <- zelig(myY ~ myX1 + myX2 + myX1:myX2, data = dat, model = "ls")
 x.out <- setx(m1, myX1 = 2:3, myX2 = .4)
 x.out2 <- setx(m1, myX1 = 2:3, myX2 = .6)
 s.out <- sim(m1, x = x.out, x1 = x.out2)
 s.out$qi$fd
@ghost ghost assigned whatever Jan 28, 2013
@mjdonnelly
Copy link

This may be related to issue #48, but I'm not sure.

The updated first differences appears to work for a single pair of observations, but not across a range:

Data prep

obs <- 1000
dat <- data.frame(cbind(rnorm(obs), runif(obs)))
names(dat) <- c("myX1", "myX2")
grps <- c("g1", "g2", "g3")
dat$grp <- as.factor(sample(grps, obs, replace = TRUE))

dat$myY <- dat$myX1 + 2_dat$myX2 - dat$myX1_dat$myX2 + rnorm(obs)

fit model

m1 <- zelig(myY ~ myX1 + myX2 + myX1:myX2 + grp, data = dat, model = "ls")

Single pair of observations

x.out <- setx(m1, myX1 = 1, myX2 = .4)
x.out2 <- setx(m1, myX1 = 1, myX2 = .6)
s.out <- sim(m1, x = x.out, x1 = x.out2)

test <- simulation.matrix(s.out, "First Differences")
summary(test)

Multiple pairs of observations

x.out <- setx(m1, myX1 = 1:2, myX2 = .4)
x.out2 <- setx(m1, myX1 = 1:2, myX2 = .6)
s.out <- sim(m1, x = x.out, x1 = x.out2)

test <- simulation.matrix(s.out, "First Differences")
summary(test)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants