# 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)
# Get a parameter list of 10 bootstrap samples (usually this should be set to 5000 or higher),
# only from the SSD model
b1 <- bootRSA(r.m, model="SSD", R=10)
# Get a table of percentile confidence intervals and p-values from these bootstrap replications
CI.boot(b1)
# Plot the final model
plot(r.m, model="SSD", xlab="Explicit intimacy motive",
ylab="Implicit affiliation motive", zlab="Negative activation")
Run the code above in your browser using DataLab