Andrzej Andrzej
Andrzej Andrzej

Reputation: 79

JMP and R give different regression Intercept and results. Why?

I have this following code:

set.seed(1000)
my_data <- rbind(
  data.frame(time = "Pre", treatment = "Control", response = rnorm(100, mean=1)),
  data.frame(time = "Pre", treatment = "Treatment", response = rnorm(100, mean=2)),
  data.frame(time = "Post", treatment = "Control", response = rnorm(100, mean=1)),
  data.frame(time = "Post", treatment = "Treatment", response = rnorm(100, mean=2))
) %>% mutate(time = factor(time, levels = c("Pre", "Post"))) %>%
mutate(treatment = factor(treatment, levels = c("Control", "Treatment")))

model3 <- lm(response ~ time * treatment, data = my_data)

summary(model3) 

Coefficients:
                             Estimate Std. Error t value
(Intercept)                  1.016379   0.096912  10.488
timePost                    -0.075329   0.137054  -0.550
treatmentTreatment           1.084046   0.137054   7.910
timePost:treatmentTreatment -0.005185   0.193824  -0.027

In JMP going through Analyze > Fit model the Intercept is equal to 1.5406361 but in R 1.016379.

What is the reason for this ? How to reproduce R results in JMP ? Update: I have done it in Jasp as well, receiving both Intercepts:

JASP

Looks like for H0 Intercept agrees with JMP and for H1 with R.

Upvotes: 0

Views: 230

Answers (0)

Related Questions