Hi all,

I have this code, but the marginal distribution plot doesn´t appear aligned
with the left plot.


I think could be something about layout or par() mar.

The code was programmed by me time ago.

Can anyone help me to get the marginal distribution on the center (more
higher centered)

id.txt

Could have this code:

05/01/2016;9335,200195
06/01/2016;9197,400391
07/01/2016;9059,299805
08/01/2016;8909,200195
11/01/2016;8886,099609
12/01/2016;8915,400391
13/01/2016;8934,5
14/01/2016;8787,700195
15/01/2016;8543,599609
18/01/2016;8469,299805
19/01/2016;8554,900391
20/01/2016;8281,400391
21/01/2016;8444,200195
22/01/2016;8722,900391
25/01/2016;8567,700195
26/01/2016;8692,5
27/01/2016;8741



g<-read.table("id.txt", col.names=c("Dateh","LAST"), sep=";", dec=",")

N=5000
B=24
ghy<-nrow(g)
r<-as.numeric(as.character(g$LAST[ghy]))


nf<-layout(matrix(c(1,1,1,1,2,2),1,6,byrow=TRUE))

par(mar=c(6,6,6,0.5))

A<-matrix(1:B,B,N);



sigma<-0.06;



mu<-0.00;


Z<-r*exp((mu-0.5*((sigma)^2)*A) +sigma*(sqrt(A))*matrix( rnorm(N*B,0,1), B,
N))

real1<-g$LAST[1:nrow(g)]

real2<-matrix(NA,nrow(g),N-1)

real<-cbind(real1,real2)




Po<-r*matrix(1,1,N);



Sim<-rbind(Po,Z)
Simulation<-rbind(real,Z)






par(mar=c(10,6,6,6))
matplot(Simulation,type="l",ylim=c(0,40000))

abline(h = 8000, lwd = 2, col = "black")

abline(h = 12000, lwd = 2, col = "black")
title("Dinamic Montecarlo Simulation 2 years ahead",font=4)

fhist<-hist(Simulation,plot=FALSE)
par(mar=c(6,0,6,6))
barplot(fhist$counts,axes=FALSE, space=0,horiz=TRUE,col="lightgray")
grid()
title("Marginal Distribution",font=4)


rect(0, 0, 0, 0) # transparent

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to