# spher.reg: Spherical-Spherical regression In Directional: Directional Statistics

## Description

It performs regression when both the dependent and independent variables are spherical.

## Usage

 `1` ```spher.reg(y, x, rads = FALSE) ```

## Arguments

 `y` The dependent variable; a matrix with either two columns, latitude and longitude, either in radians or in degrees. Alternatively it is a matrix with three columns, unit vectors. `x` The dependent variable; a matrix with either two columns, latitude and longitude, either in radians or in degrees. Alternatively it is a matrix with three columns, unit vectors. The two matrices must agree in the scale and dimensions. `rads` If the data are expressed in latitude and longitude then it matter to know if they are in radians or degrees. If they are in radians, then this should be TRUE and FALSE otherwise. If the previous argument, euclidean, is TRUE, this one does not matter what its value is.

## Details

Spherical regression as proposed by Chang (1986) is implemented. If the estimated rotation matrix has a determinant equal to -1, singualr value decomposition is performed and the last unit vector of the second matrix is multiplied by -1.

## Value

A list including:

 `A` The estimated rotation matrix. `fitted` The fitted values in Euclidean coordinates (unit vectors).

## Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris <[email protected]> and Giorgos Athineou <[email protected]>

## References

Ted Chang (1986). Spherical Regression. Annals of Statistics, 14(3): 907–924.

```spher.cor, spml.reg, circ.cor1, circ.cor2, sphereplot ```

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15``` ```mx <- rnorm(3) mx <- mx/sqrt( sum(mx^2) ) my <- rnorm(3) my <- my/sqrt( sum(my^2) ) x <- rvmf(100, mx, 15) A <- rotation(mx, my) y <- x %*% t(A) mod <- spher.reg(y, x) A mod\$A ## exact match, no noise y <- x %*% t(A) y <- y + rvmf(100, colMeans(y), 40) mod <- spher.reg(y, x) A mod\$A ## noise added, more relistic example ```

### Example output

```            [,1]       [,2]        [,3]
[1,]  0.90579529 0.42350258 -0.01343352
[2,] -0.42268322 0.90092234 -0.09837598
[3,] -0.02955992 0.09478662  0.99505865
[,1]       [,2]        [,3]
[1,]  0.90579529 0.42350258 -0.01343352
[2,] -0.42268322 0.90092234 -0.09837598
[3,] -0.02955992 0.09478662  0.99505865
[,1]       [,2]        [,3]
[1,]  0.90579529 0.42350258 -0.01343352
[2,] -0.42268322 0.90092234 -0.09837598
[3,] -0.02955992 0.09478662  0.99505865
[,1]       [,2]        [,3]
[1,]  0.90479065 0.42536500 -0.02045728
[2,] -0.42552632 0.90115336 -0.08276450
[3,] -0.01676997 0.08358966  0.99635914
```

Directional documentation built on Nov. 12, 2018, 5:05 p.m.