# A Model of Mutual Learning in accordance with March (1991) n<-50 # The number of individuals. m<-30 # The number of dimensions. p1<-0.1 # The socialization rate. p2<-0.1 # The organization learning rate. set.seed(501) # A random seed is 501. # Reality has m dimensions. # Each dimension has a value of -1 or 1 with independent equal probability 0.5. r<-matrix(runif(m),1,m) for(i in 1:m){ if(r[i] >= 0.5){ r[i]<- 1 }else{ r[i]<- -1} } # Each of n individuals holds prior beliefs about reality. # For each dimension of reality, each prior belief has a value of -1, 0, or 1 with equal probability 1/3. b<-matrix(runif(n*m),n,m) for(i in 1:n){ bP<-b[i,] for(j in 1:m){if(bP[j] <= 0.3333333){ bP[j]<- -1 }else if(( bP[j]> 0.3333333) && (bP[j] <= 0.6666667)){ bP[j]<- 0 }else{ bP[j]<- 1 } b[i,j]<-bP[j] }} # CKL is the knowledge level of the organization code. C<-matrix(rep(0),1,m) CKLC<-function(C,r){ TrC<-0 for(i in 1:m){ if(C[,i] == r[,i]){ TrC<- TrC+1 } } CKL<- TrC/m ; return(CKL) } CKL<-CKLC(C,r) # MKL is the knowledge level of individuals. MKL<-matrix(rep(0),n,1) MKLC<-function(b,r){ for(j in 1:n){ TrC<-0 ; B<-b[j,] for(i in 1:m){ if(B[i] == r[,i]){ TrC<- TrC+1 } } MKL[j,]<- TrC/m } ; return(MKL)} MKL<-MKLC(b,r) MKLA<-matrix(rep(0),1,80) # The average of individual knowledge levels of all 80 periods. EQAR<-matrix(rep(0),1,80) # The equilibrium rate of all 80 periods. # EQWI is 1 (equilibrium) if all the beliefs of the organization code and individuals are equal. EQWI<-function(b,C){ TrEN<-0 ; TrE<-0 for(j in 1:n){ B<-b[j,] for(i in 1:m){ if(B[i] == C[,i]){ TrE<- TrE+1 } } } nm<-n*m ; if(TrE == nm){ TrEN<-1 } ; return(TrEN)} SG<-matrix(rep(0),1,n) # The ith dimension is 1 if the ith member belongs to the superior group. SGB<- matrix(rep(2),1,m) # The initial value is 2, which means no dominant belief within the superior group. # Individuals modify their beliefs as a consequence of socialization into the organization code. B<-matrix(rep(0),n,m) # Individual beliefs, code belief, and superior group belief at each period. BT<-NULL CT<-NULL SGBT<-NULL # The simulation starts. t<-1 # The number of periods. t <= 80. while(t <= 80){ ## Individuals learn from the organization code. # If the code is 0 on a particular dimension, then individual belief is not affected. # If the code differs on any particular dimension from the individual belief, # then individual belief changes to that of the code with probability p1 (when A is below p1). for(j in 1:n){ for(i in 1:m){ if((C[i] != 0) && (C[i] != b[j,i])){ A<-runif(1) }else{ A<- 1.1 } ; if(A <= p1){ b[j,i] <- C[i] } } } # The superior group is composed of individuals whose knowledge levels are superior to that of the code. for(j in 1:n){ MKLB<-MKL[j,] ; if(MKLB > CKL){ SG[,j] <- 1 }else{ SG[,j] <- 0 } } # Individuals are selected from the superior group. SGb<-cbind(b,t(SG)) ; SGb<-subset(SGb,SGb[,m+1] == 1) ; SGb<-SGb[,1:m] ; SGN<-sum(SG) if(SGN != 0){ SGbN <- matrix(rep(0),m,3) # The number of individual beliefs within superior group. if(SGN != 1){ for(j in 1:SGN){ SGb2<-SGb[j,] for(i in 1:m){ if(SGb2[i] == -1){ SGbN[i,1]<-SGbN[i,1]+1 }else if(SGb2[i] == 0){ SGbN[i,2]<-SGbN[i,2]+1 }else{ SGbN[i,3]<-SGbN[i,3]+1 } } } }else{SGb2<-SGb ; for(i in 1:m){ if(SGb2[i] == -1){ SGbN[i,1]<-SGbN[i,1]+1 }else if(SGb2[i] == 0){ SGbN[i,2]<-SGbN[i,2]+1 }else{ SGbN[i,3]<-SGbN[i,3]+1 } } } # SGN is dominant belief within the superior group. for(i in 1:m){ if((SGbN[i,1] <= SGbN[i,2]) && (SGbN[i,2] < SGbN[i,3])){ SGB[1,i] <- 1 }else if((SGbN[i,2] <= SGbN[i,1]) && (SGbN[i,1] < SGbN[i,3])){ SGB[1,i] <- 1 }else if((SGbN[i,1] <= SGbN[i,3]) && (SGbN[i,3] < SGbN[i,2])){ SGB[1,i] <- 0 }else if((SGbN[i,3] <= SGbN[i,1]) && (SGbN[i,1] < SGbN[i,2])){ SGB[1,i] <- 0 }else if((SGbN[i,2] <= SGbN[i,3]) && (SGbN[i,3] < SGbN[i,1])){ SGB[1,i] <- -1 }else if((SGbN[i,3] <= SGbN[i,2]) && (SGbN[i,2] < SGbN[i,1])){ SGB[1,i] <- -1 }else{ SGB[1,i] <- 2 #if there is no dominant belief } } # Calculation of k. k<-matrix(rep(0),1,m) for(i in 1:m){ if(C[i] == 1){ NM<-SGbN[i,2]+SGbN[i,1] ; MM<-SGbN[i,3] ; k[i] <- NM - MM }else if(C[i] == 0){ NM<-SGbN[i,1]+SGbN[i,3] ; MM<-SGbN[i,2] ; k[i] <- NM - MM }else if(C[i] == -1){ NM<-SGbN[i,2]+SGbN[i,3] ; MM<-SGbN[i,1] ; k[i] <- NM - MM } } ## The organization code adapts to the individual beliefs within the superior group. for(i in 1:m){if((SGB[,i] != 2) && (C[,i] != SGB[,i]) && (k[,i] > 0)){ A<-runif(1) ; q<- 1- (1-p2)^k[,i] ; if(A <= q){ C[,i] <- SGB[,i] } } } } } CKL<-CKLC(C,r) #Knowledge level of the code after adaptation. MKL<-MKLC(b,r) #Knowledge level of individuals after socialization. MKLA[1,t]<-sum(MKL)/n #Average knowledge level of individuals after socialization. # Calculation of equilibrium rate. eqm<-0 for(j in 1:n){ b2<-b[j,] for(i in 1:m){ if(b2[i] == C[,i]){ eqm<-eqm+1 } } } EQAR[1,t]<-eqm/(n*m) BT[[t]]<-b CT[[t]]<-C SGBT[[t]]<-SGB t<-t+1 } # Print MKLA EQAR EQWI(b,C)