can_lm: Transform a Multivariate Linear model mlm to a Canonical...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/can_lm.R

Description

This function uses candisc to transform the responses in a multivariate linear model to scores on canonical variables for a given term and then uses those scores as responses in a linear (lm) or multivariate linear model (mlm).

Usage

1
can_lm(mod, term, ...)

Arguments

mod

A mlm object

term

One term in that model

...

Arguments passed to candisc

Details

The function constructs a model formula of the form Can ~ terms where Can is the canonical score(s) and terms are the terms in the original mlm, then runs lm() with that formula.

Value

A lm object if term is a rank 1 hypothesis, otherwise a mlm object

Author(s)

Michael Friendly

See Also

candisc, cancor

Examples

1
2
3
4
5
iris.mod <- lm(cbind(Petal.Length, Sepal.Length, Petal.Width, Sepal.Width) ~ Species, data=iris)
iris.can <- can_lm(iris.mod, "Species")
iris.can
Anova(iris.mod)
Anova(iris.can)

Example output

Loading required package: car
Loading required package: carData
Loading required package: heplots

Attaching package: 'candisc'

The following object is masked from 'package:stats':

    cancor


Call:
lm(formula = cbind(Can1, Can2) ~ Species, data = scores)

Coefficients:
                   Can1     Can2   
(Intercept)        -7.6076  -0.2151
Speciesversicolor   9.4326   0.9430
Speciesvirginica   13.3902  -0.2976


Type II MANOVA Tests: Pillai test statistic
        Df test stat approx F num Df den Df    Pr(>F)    
Species  2    1.1919   53.466      8    290 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Type II MANOVA Tests: Pillai test statistic
        Df test stat approx F num Df den Df    Pr(>F)    
Species  2    1.1919   108.41      4    294 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

candisc documentation built on Oct. 8, 2021, 1:08 a.m.