```
# NOT RUN {
d <- datadist(data=1) # use all variables in search pos. 1
d <- datadist(x1, x2, x3)
page(d) # if your options(pager) leaves up a pop-up
# window, this is a useful guide in analyses
d <- datadist(data=2) # all variables in search pos. 2
d <- datadist(data=my.data.frame)
d <- datadist(my.data.frame) # same as previous. Run for all potential vars.
d <- datadist(x2, x3, data=my.data.frame) # combine variables
d <- datadist(x2, x3, q.effect=c(.1,.9), q.display=c(0,1))
# uses inter-decile range odds ratios,
# total range of variables for regression function plots
d <- datadist(d, z) # add a new variable to an existing datadist
options(datadist="d") #often a good idea, to store info with fit
f <- ols(y ~ x1*x2*x3)
options(datadist=NULL) #default at start of session
f <- ols(y ~ x1*x2)
d <- datadist(f) #info not stored in `f'
d$limits["Adjust to","x1"] <- .5 #reset adjustment level to .5
options(datadist="d")
f <- lrm(y ~ x1*x2, data=mydata)
d <- datadist(f, data=mydata)
options(datadist="d")
f <- lrm(y ~ x1*x2) #datadist not used - specify all values for
summary(f, x1=c(200,500,800), x2=c(1,3,5)) # obtaining predictions
plot(Predict(f, x1=200:800, x2=3)) # or ggplot()
# Change reference value to get a relative odds plot for a logistic model
d$limits$age[2] <- 30 # make 30 the reference value for age
# Could also do: d$limits["Adjust to","age"] <- 30
fit <- update(fit) # make new reference value take effect
plot(Predict(fit, age, ref.zero=TRUE, fun=exp),
ylab='Age=x:Age=30 Odds Ratio') # or ggplot()
# }
```

Run the code above in your browser using DataCamp Workspace