# orientlm: Linear models for orientation data In orientlib: Support for Orientation Data

## Description

Regression models for matched pairs of orientations.

## Usage

 ```1 2 3``` ```orientlm(observed, leftformula, trueorient = rotmatrix(diag(3)), rightformula, data = list(), subset, weights, na.action, iterations = 5) ```

## Arguments

 `observed` Observed orientations `leftformula` Formula for “left” model (see below) `trueorient` “True” orientation (see below) `rightformula` Formula for “right” model (see below) `data` Optional data frame for predictors in linear model `subset` Optional logical vector indicating subset of data `weights` Optional weights `na.action` Optional NA function for predictors `iterations` How many iterations to use. Ignored unless both `leftformula` and `rightformula` are specified.

## Details

The Prentice (1989) model for matched pairs of orientations was

E(Vi) = k t(A1) %*% Ui %*% A2

where Vi is the observed orientation, A1 and A2 are orientation matrices, and Ui is the “true” orientation, and k is a constant. It was assumed that errors were symmetrically distributed about the identity matrix.

This function generalizes this model, allowing A1 and A2 to depend on regressor variables through `leftformula` and `rightformula` respectively. These formulas should include the predictor variables (right hand side) only, e.g. use `~ x + y + z` rather than `response ~ x + y + z`. Specify the response using the `observed` argument. If both formulas are `~ 1`, i.e. intercepts only, then Prentice's original model is recovered. More general models are fit by coordinatewise linear regression in the `rotmatrix` representation of the orientation, with fitted values projected onto SO(3) using the `nearest.SO3` function.

When both left and right models are given, Prentice's iterative approach is used with a fixed number of iterations. Note that Shin (1999) found that Prentice's scheme sometimes fails to find the global minimum; this function presumably suffers from the same failing.

## Value

Returns a list containing the following components:

 `leftfit ` Result of `lm` call based on `leftformula` `rightfit ` Result of `lm` call based on `rightformula` `A1 ` Fitted values of A1 for each observation `A2 ` Fitted values of A2 for each observation `predict` Fitted values of t(A1) %*% Ui %*% A2 for each observation

Duncan Murdoch

## References

Prentice, M.J. (1989). Spherical regression on matched pairs of orientation statistics. JRSS B 51, 241-248.

Shin, H.S.H. (1999). Experimental Design for Orientation Models. PhD thesis, Queen's University.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12``` ```x <- rep(1:10,10) y <- rep(1:10,each=10) A1 <- skewvector(cbind(x/10,y/10,rep(0,100))) A2 <- skewvector(c(1,1,1)) trueorientation <- skewvector(matrix(rnorm(300),100)) noise <- skewvector(matrix(rnorm(300)/10,100)) obs <- t(A1) %*% trueorientation %*% A2 %*% noise fit <- orientlm(obs, ~ x + y, trueorientation, ~ 1) context <- boat3d(A1, x, z=y, col = 'green', graphics='scatterplot3d') boat3d(fit\$A1, x, z=y, add=context) ```

### Example output ```Loading required package: scatterplot3d
```

orientlib documentation built on July 1, 2020, 6:09 p.m.