Learn R Programming

regress3d (version 1.0.0)

create_surface_data: Create data frame used to plot a surface of predicted y values

Description

Create data frame used to plot a surface of predicted y values. There can be only exactly 2 columns of x values. The predicted y values can be estimated from an lm or glm model. Interaction terms are allowed, as are weights.

Usage

create_surface_data(data, model)

Value

A data frame with generated values for two x variables, as well as the predicted y values and predicted confidence intervals for each pair of x values. These can be used to plot the estimated regression surface and confidence interval surfaces.

Arguments

data

A data frame being used to estimate the regression model

model

A glm with exactly two x variables

Examples

Run this code
mymodel <- lm(length ~ isFemale_num + isMale_num,
              data = hair_data)
surface_data <- create_surface_data(data = hair_data,
                                    model = mymodel)

Run the code above in your browser using DataLab