intQualQuant: Predictions for Factor-Numeric Interactions in Linear Models

Description Usage Arguments Value Author(s) Examples

View source: R/DAMisc_functions.R

Description

This function works on linear models with a single interaction between a continuous (numeric) variable and a factor. The output is a data frame that gives the predicted effect of moving from each category to each other category of the factor over the range of values of the continuous conditioning variable.

Usage

1
2
3
	intQualQuant(obj, vars, level = .95, labs=NULL, 
		n=10, onlySig=FALSE, plot=FALSE, 
		vals = NULL)

Arguments

obj

An object of class lm.

vars

A vector of two variable names giving the two quantitative variables involved in the interaction. These variables must be involved in one, and only one, interaction.

level

Confidence level desired for lower and upper bounds of confidence interval.

labs

An optional vector of labels that will be used to identify the effects, if NULL, the factor levels will be used.

n

Number of values of the conditioning variable to use.

onlySig

Logical indicating whether only contrasts with significant differences should be returned. Significance is determined to exist if the largest lower bound is greater than zero or the smallest upper bound is smaller than zero.

plot

Logical indicating whether a plot should be made (if TRUE) or the data should be returned (if FALSE).

vals

A vector of values at which the continuous variable will be held constant. If NULL, a sequence of length n across the variable's range will be used.

Value

A data frame with the following values:

fit

The expected difference between the two factor levels at the specified value of the conditioning variable.

se.fit

The standard error of the expected differences.

x

The value of the continuous conditioning variable

contrast

A factor giving the two values of the factor being evaluated.

lower

The lower 95% confidence interval for fit

upper

The upper 95% confidence interval for fit

Author(s)

Dave Armstrong (UW-Milwaukee, Department of Political Science)

Examples

1
2
3
4
5
library(car)
data(Ornstein)
mod <- lm(interlocks ~ log(assets)*nation, data=Ornstein)
mod.out <- intQualQuant(mod, c("log(assets)", "nation"), 
	n=25, plot=FALSE)

DAMisc documentation built on May 2, 2019, 4:52 p.m.