Spherical-spherical regression | R Documentation |
It performs regression when both the dependent and independent variables are spherical.
spher.reg(y, x, rads = FALSE)
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. |
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.
A list including:
A |
The estimated rotation matrix. |
fitted |
The fitted values in Euclidean coordinates (unit vectors). |
Michail Tsagris.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr and Giorgos Athineou <gioathineou@gmail.com>.
Ted Chang (1986). Spherical Regression. Annals of Statistics, 14(3): 907–924.
spher.cor, spml.reg, circ.cor1, circ.cor2, sphereplot
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.