[R-sig-Geo] package for bidimemsional regression
Hisaji ONO
hi_ono2001 at ybb.ne.jp
Thu Jul 17 20:22:10 CEST 2008
Hello.
I've tried to implement Euclid and Affine versions of
Bidimensional Analysis.
#
#algorithms an data from Nakaya, T. (1998): Statistical
analysis of spatial distortion: an application of
bidimensional regression procedure, The Ritsumeikan
Bungaku 553, 1333-1356. in Japanese
#
# You had better refer to, "Nakaya, T. (1997): Statistical
inferences in bidimensional regression models,
Geographical Analysis 29, 169-186." too.
# sample data
#kanazawa1.csv
#
0.105,0.515,0.041,0.536
0.88,-0.122,0.445,-0.047
1.057,1.109,0.773,0.83
1.262,0.463,0.747,0.309
2.316,-0.037,1.328,-0.687
3.293,-0.149,2.007,-1.452
-0.743,2.092,-0.316,1.457
-0.964,1.328,-0.497,1.12
-1.249,2.322,-0.629,1.632
-0.179,-0.689,-0.124,-0.25
0.832,-0.926,0.309,-0.611
2.217,-1.092,0.847,-0.959
-0.352,-1.571,-0.368,-0.503
1.434,-2.092,0.44,-1.543
-0.611,-2.908,-0.964,-1.707
0.497,-2.989,-0.379,-1.763
2.333,1.214,1.83,-0.134
3.13,1.307,2.184,-0.752
2.296,2.232,1.763,0.72
d<-read.csv("F://tobler/bidimension_regression/kanazawa1.csv",header=
FALSE)
u<-d[,1]
v<-d[,2]
x<-d[,3]
y<-d[,4]
#
# Euclid version of Bidimensional Regression
#using design matrix
#
d1<-cbind(c(d[,1],d[,2]),c(rep(1,nrow(d)),rep(0,nrow(d))),c(rep(0,nrow(d)),rep(1,nrow(d))),c(d[,3],d[,4]),c(d[,4]*-1,d[,3]))
lu<-lm(d1[,1] ~ d1[,2]+d1[,3]+d1[,4]+d1[,5] - 1)
a1<-lu$coefficients[3]
a2<-lu$coefficients[4]
b1<-lu$coefficients[1]
b2<-lu$coefficients[2]
cc<-sqrt(a1*a1+a2*a2)
theta<-acos(a1/cc)
#predict values
uv<-predict(lu)
uu<-uv[1:(length(uv)/2)]
vv<-uv[(length(uv)/2 +1):length]
#draw scattergram
plot(u,v)
points(uu,vv,col="red")
#
# Affine version of Bidimensional Regression
#
daf<-cbind(c(d[,1],d[,2]),c(rep(1,nrow(d)),rep(0,nrow(d))),c(rep(0,nrow(d)),rep(1,nrow(d))),c(d[,3],rep(0,nrow(d))),c(d[,4],rep(0,nrow(d))),c(rep(0,nrow(d)),d[,3]),c(rep(0,nrow(d)),d[,4]))
la<-lm(daf[,1] ~
daf[,2]+daf[,3]+daf[,4]+daf[,5]+daf[,6]+daf[,7] - 1)
I hope this will help you.
Regards.
--- Marco Helbich <marco.helbich at gmx.at> wrote:
> Dear list,
>
> Is there a package available, which computes the
> "bidimemsional regression"?
> For literature see e.g.
>
> Tobler, W: Bidimensional Regression, Geographical
> Analysis, 26: 186-212.
>
> Friedman, A; Kohler, B 2003: Bidimensional
> regression: A method for
> assessing the configural similarity of cognitive
> maps and other
> two-dimensional data. Psychological Methods, B,
> 468-491
>
> I appreciate every hint!
>
> Best regards
> Marco Helbich
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
More information about the R-sig-Geo
mailing list