R/RandomArrival.R

Defines functions RandomArrival

Documented in RandomArrival

RandomArrival <-
function(E,C,Names=NULL){

z<-length(C)
P<-permn(z)	
elementos<-length(P)
pagos<-matrix(0,nrow=elementos,ncol=z)
for (i in 1:elementos){
	orden<-P[[i]]
	for (j in 1:z){
		pagos[i, orden[j] ]<- min(C[orden[j]],max(0,E-sum(pagos[i,])))
		}
	}
	
	
	res<-apply(pagos,2,mean)
	R<-as.matrix(res)
 	rownames(R)<-Names
 	colnames(R)<-"RA"
 	Output<-list(Results=R,Claims=C,Method="Random Arrival",Short="RA",E=E,Names=Names)
    class(Output)<-"ClaimsRule"
    return(Output)  
	
}

Try the GameTheory package in your browser

Any scripts or data that you put into this service are public.

GameTheory documentation built on July 4, 2017, 5:02 p.m.