Title: | Calculates the Bidimensional Regression Between Two 2D Configurations |
---|---|
Description: | Calculates the bidimensional regression between two 2D configurations following the approach by Tobler (1965). |
Authors: | Claus-Christian Carbon [aut] , Alexander Pastukhov [aut, cre] |
Maintainer: | Alexander Pastukhov <[email protected]> |
License: | GPL-3 |
Version: | 2.0.1 |
Built: | 2025-01-02 03:41:29 UTC |
Source: | https://github.com/alexander-pastukhov/bidim-regression |
Anova for lm2 objects, returns a table with pairwise comparisons between models or, if only one model was supplied, with the null model.
## S3 method for class 'lm2' anova(object, ...)
## S3 method for class 'lm2' anova(object, ...)
object |
an object of class "lm2" |
... |
further objects of class "lm2" |
an anova data frame
lm2euc <- lm2(depV1+depV2~indepV1+indepV2, NakayaData, transformation = 'Euclidean') lm2aff <- lm2(depV1+depV2~indepV1+indepV2, NakayaData, transformation = 'Affine') anova(lm2euc, lm2aff)
lm2euc <- lm2(depV1+depV2~indepV1+indepV2, NakayaData, transformation = 'Euclidean') lm2aff <- lm2(depV1+depV2~indepV1+indepV2, NakayaData, transformation = 'Affine') anova(lm2euc, lm2aff)
Calculates the bidimensional regression between two 2D configurations using both Euclidean and Affine transformations following the approach by Tobler (1965).
This function assumes strict data format and returns all coefficients and statistics in a single structure. Same functionality is now re-implemented in a R-friendly style, see lm2
function.
BiDimRegression(coord)
BiDimRegression(coord)
coord |
table that must contain two columns for dependent variables (named |
an S3 class BiDimRegression
containing all essential measures of the bidimensional regression
euclidean.r, affine.r
- the regression coefficient, defined analogously to Pearson's r.
euclidean.rsqr, affine.rsqr
- the squared regression coefficient.
euclidean.diABSqr, affine.diABSqr
- the squared distortion index for dependent variables; following Waterman and Gordon's (1984) extension of the bidimensional regression, it provides a measure of comparison of distortions, but the range of values is 0 to 1 following Friedman and Kohler (2003).
euclidean.dMaxABSqr, affine.dMaxABSqr
- the maximal squared distortion index for dependent variables.
euclidean.diXYSqr, affine.diXYSqr
- the distortion index for independent variables.
euclidean.dMaxXYSqr, affine.dMaxXYSqr
- the maximal squared distortion index for independent variables.
euclidean.scaleFactorX, affine.scaleFactorX
- the scaling factor of the first dimension (1.0 means no scaling; values below 1.0 indicate a contraction, values above 1.0 indicate an expansion).
euclidean.scaleFactorY, affine.scaleFactorY
- the scaling factor of the second dimension.
euclidean.angleDEG, affine.angleDEG
- the rotation angle in degrees.
euclidean.shear, affine.shear
- shearing of the transformed configuration, always zero for the Euclidean transformation.
euclidean.ttestDF, affine.ttestDF
- degrees of freedom (DF) for the t-tests regarding the model parameters (alphas and betas).
euclidean.alpha1.*, euclidean.alpha2.*, affine.alpha1.*, affine.alpha2.*
- intercept vectors, information includes .coeff
for coefficient, .SE
for standard error, tValue
for t-statistics, and pValue
for significance.
euclidean.beta1.*, euclidean.beta2.*, affine.beta1.*, affine.beta2.*, affine.beta3.*, affine.beta4.*
- slope vectors, information includes .coeff
for coefficient, .SE
for standard error, tValue
for t-statistics, and pValue
for significance.
euclidean.fValue, affine.fValue
- F-statistics, following the advice of Nakaya (1997).
euclidean.df1, affine.df1
- degrees of freedom of the nominator used for the F-statistics propagated by Nakaya (1997); df1 = p-2, with p is the number of elements needed to calculate the referring model: p=4 for the Euclidean and p=6 for the affine geometry Nakaya, 1997, Table 1.
euclidean.df2, affine.df2
- degrees of freedom of the denominator used for the F-statistics propagated by Nakaya (1997); df2 = 2n-p, with p is the number of elements needed to calculate the referring model (see df1) and n is the number of coordinate pairs.
euclidean.pValue, affine.pValue
- the significance level based on the preceding F-statistics.
euclidean.dAICso, affine.dAICso
- the AIC difference between the regarding bidimensional regression model and the bidimensional null model (S0) according to Nakaya (1997), formula 56.
eucVSaff.*
- statistical comparison between Euclidean and Affine models, include .fValue
for F-statistics, .df1
and .df2
for the degrees of freedom, .pValue
for the significance level, and .dAIC
for AIC difference between two models.
resultingMeasures <- BiDimRegression(NakayaData) print(resultingMeasures)
resultingMeasures <- BiDimRegression(NakayaData) print(resultingMeasures)
Example 1 from the domain of aesthetics to show how the method can be utilized for assessing the similarity of two portrayed persons, actually the Mona Lisa in the world famous Louvre version and the only recently re-discovered Prado version
data(CarbonExample1Data)
data(CarbonExample1Data)
A data frame with 36 observations on the following 4 variables.
depV1
a numeric vector
depV2
a numeric vector
indepV1
a numeric vector
indepV2
a numeric vector
data(CarbonExample1Data) ## maybe str(CarbonExample1Data) ; plot(CarbonExample1Data) ...
data(CarbonExample1Data) ## maybe str(CarbonExample1Data) ; plot(CarbonExample1Data) ...
Example 2 originates from the area of geography and inspects the accuracy of different maps of the city of Paris which were created over the last 350 years as compared to a recent map
data(CarbonExample2Data)
data(CarbonExample2Data)
A data frame with 13 observations on the following 4 variables.
depV1
a numeric vector
depV2
a numeric vector
indepV1
a numeric vector
indepV2
a numeric vector
data(CarbonExample2Data) ## maybe str(CarbonExample2Data) ; plot(CarbonExample2Data) ...
data(CarbonExample2Data) ## maybe str(CarbonExample2Data) ; plot(CarbonExample2Data) ...
Example 3 focuses on demonstrating how good a cognitive map recalculated from averaged cognitive distance data fits with a related real map
data(CarbonExample3Data)
data(CarbonExample3Data)
A data frame with 10 observations on the following 4 variables.
depV1
a numeric vector
depV2
a numeric vector
indepV1
a numeric vector
indepV2
a numeric vector
data(CarbonExample3Data) ## maybe str(CarbonExample3Data) ; plot(CarbonExample3Data) ...
data(CarbonExample3Data) ## maybe str(CarbonExample3Data) ; plot(CarbonExample3Data) ...
A dataset containing a monocular eye gaze recording with calibration sequence. Courtesy of Bamberger Baby Institut (BamBI).
EyegazeData
EyegazeData
A data frame with 365 rows and 6 variables:
sample timestamp, in milliseconds
recorded gaze, in internal eye tracker units
location of the calibration target on the screen, in pixels
index of the target within the sequence
...
Data from Friedman, A., & Kohler, B. (2003). Bidimensional regression: Assessing the configural similarity and accuracy of cognitive maps and other two-dimensional data sets. Psychological Methods, 8(4), 468-491.
data(FriedmanKohlerData1)
data(FriedmanKohlerData1)
A data frame with 4 observations on the following 4 variables.
depV1
a numeric vector
depV2
a numeric vector
indepV1
a numeric vector
indepV2
a numeric vector
data(FriedmanKohlerData1) ## maybe str(FriedmanKohlerData1) ; plot(FriedmanKohlerData1) ...
data(FriedmanKohlerData1) ## maybe str(FriedmanKohlerData1) ; plot(FriedmanKohlerData1) ...
Data from Friedman, A., & Kohler, B. (2003). Bidimensional regression: Assessing the configural similarity and accuracy of cognitive maps and other two-dimensional data sets. Psychological Methods, 8(4), 468-491.
data(FriedmanKohlerData2)
data(FriedmanKohlerData2)
A data frame with 4 observations on the following 4 variables.
depV1
a numeric vector
depV2
a numeric vector
indepV1
a numeric vector
indepV2
a numeric vector
data(FriedmanKohlerData2) ## maybe str(FriedmanKohlerData2) ; plot(FriedmanKohlerData2) ...
data(FriedmanKohlerData2) ## maybe str(FriedmanKohlerData2) ; plot(FriedmanKohlerData2) ...
lm2 is used to fit bidimensional linear regression models using Euclidean and Affine transformations following the approach by Tobler (1965).
lm2(formula, data, transformation)
lm2(formula, data, transformation)
formula |
a symbolic description of the model to be fitted in the format |
data |
a data frame containing variables for the model. |
transformation |
the transformation to be used, either |
lm2 returns an object of class "lm2". An object of class "lm" is a list containing at least the following components:
transformation |
string with the transformation type ( |
npredictors |
number of predictors used in the model: 4 for euclidean, 6 for affine, 8 for projective. |
df_model , df_residual
|
degrees of freedom for the model and for the residuals |
transformation_matrix |
|
coeff |
transformation coefficients, with |
transformed_coeff |
|
fitted_values |
data frame containing fitted values for the original data set |
residuals |
data frame containing residuals for the original fit |
r.squared , adj.r.squared
|
R-squared and adjusted R-squared. |
F , p.value
|
F-statistics and the corresponding p-value, given the |
dAIC |
Akaike Information Criterion (AIC) difference between the regression model and the null model. A negative values indicates that the regression model is better. See Nakaya (1997). |
distortion_index |
Distortion index following Waterman and Gordon (1984), as adjusted by Friedman and Kohler (2003) |
lm |
an underlying linear model for |
formula |
formula, describing input and output columns |
data |
data used to fit the model |
Call |
function call information, incorporates the |
lm2euc <- lm2(depV1 + depV2 ~ indepV1 + indepV2, NakayaData, 'euclidean') lm2aff <- lm2(depV1 + depV2 ~ indepV1 + indepV2, NakayaData, 'affine') lm2prj <- lm2(depV1 + depV2 ~ indepV1 + indepV2, NakayaData, 'projective') anova(lm2euc, lm2aff, lm2prj) predict(lm2euc) summary(lm2euc)
lm2euc <- lm2(depV1 + depV2 ~ indepV1 + indepV2, NakayaData, 'euclidean') lm2aff <- lm2(depV1 + depV2 ~ indepV1 + indepV2, NakayaData, 'affine') lm2prj <- lm2(depV1 + depV2 ~ indepV1 + indepV2, NakayaData, 'projective') anova(lm2euc, lm2aff, lm2prj) predict(lm2euc) summary(lm2euc)
Data from Nakaya, T. (1997). Statistical inferences in bidimensional regression models. Geographical Analysis, 29(2), 169-186.
data(NakayaData)
data(NakayaData)
A data frame with 19 observations on the following 4 variables.
depV1
a numeric vector
depV2
a numeric vector
indepV1
a numeric vector
indepV2
a numeric vector
data(NakayaData) ## maybe str(NakayaData) ; plot(NakayaData) ...
data(NakayaData) ## maybe str(NakayaData) ; plot(NakayaData) ...
Predicted values based on the bidimensional regressional model object.
## S3 method for class 'lm2' predict(object, newdata, ...)
## S3 method for class 'lm2' predict(object, newdata, ...)
object |
an object of class "lm2" |
newdata |
An optional two column data frame with independent variables. If omitted, the fitted values are used. |
... |
optional arguments |
a two column data frame with predicted values for dependent variables.
lm2euc <- lm2(depV1+depV2~indepV1+indepV2, NakayaData, transformation = 'Euclidean') predict(lm2euc, NakayaData[, 3:4])
lm2euc <- lm2(depV1+depV2~indepV1+indepV2, NakayaData, transformation = 'Euclidean') predict(lm2euc, NakayaData[, 3:4])