# Compute response surface from a fake data set
set.seed(0xBEEF)
n <- 300
err <- 15
x <- rnorm(n, 0, 5)
y <- rnorm(n, 0, 5)
df <- data.frame(x, y)
df <- within(df, {
diff <- x-y
absdiff <- abs(x-y)
sqdiff <- (x-y)^2
z.diff <- diff + rnorm(n, 0, err)
z.abs <- absdiff + rnorm(n, 0, err)
z.sq <- sqdiff + rnorm(n, 0, err)
z.add <- diff + 0.4*x + rnorm(n, 0, err)
z.complex <- 0.4*x + - 0.2*x*y + + 0.1*x^2 - 0.03*y^2 + rnorm(n, 0, err)
})
r1 <- RSA(z.sq~x*y, df)
print(r1)
compare(r1)
plot(r1)
plot(r1, model="SRSD")
plot(r1, model="full", type="c")
getPar(r1, "coef") # print model parameters including SE and CI
RSA.ST(r1) # get surface parameters
# Motive congruency example
data(motcon)
r.m <- RSA(negAct~EM*IM, motcon)
Run the code above in your browser using DataLab