Learn R Programming

weightr (version 2.0.0)

predict: Predicted Values for 'weightfunct' Objects

Description

This function calculates predicted conditional means and their corresponding standard errors for objects of class weightfunct.

Usage

predict(x, values = NULL, ...)

Arguments

x

an object of class weightfunct

values

a vector or matrix specifying the values of the moderator variables for which predicted values should be calculated; defaults to NULL

...

other arguments

Value

The function returns a list containing the following components: unadjusted, adjusted, and values. The values section simply prints the values matrix for verification. The unadjusted and adjusted sections print the conditional means for each row of new data, unadjusted and adjusted for publication bias (respectively), and their standard errors.

Details

predict(x) requires that the user specify a vector or matrix of predictor values. Without specifying values, the function will not work.

For models including y number of moderator variables, users should set values equal to a k x y matrix, where k is the number of rows of data (i.e., "new" studies). In the example code, for example, there are 3 moderator variables and one row of data, so values is a 1 x 3 matrix. The intercept is incldued by default.

Note that weightfunct handles categorical moderators automatically. To include them here, the appropriate contrast (dummy) variables must be explicitly specified. The contrasts function can help to understand the contrast matrix for a given factor.

Examples

Run this code
# NOT RUN {
test <- weightfunct(effect, v, steps)
values <- matrix(c(0,1,0),ncol=3) # An arbitrary set of 3 dummy-coded moderators
predict(test, values)
# }

Run the code above in your browser using DataLab