531f10NR - # # STAT 531 NR # cau = function(x,theta)...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 ############################################################# # STAT 531 NR ############################################################# cau = function(x,theta) dcauchy(x,location=0, scale=theta) curve(cau(x,0.5),-4,4, col="orange", type="l",xlab="x",ylab="p(x)") curve(cau(x, 1), -4,4, col="red", type="l",xlab="x",ylab=" ", add=T) curve(cau(x, 2), -4,4, col="blue", type="l",xlab="x",ylab=" ", add=T) ############################################################# ref=rcauchy(400) f=function(theta){-sum(log(1+(x-theta)^2))} mi=NULL for (i in 1:400){ x=ref[1:i] aut=optimise(f,interval=c(-10,10), maximum=T) mi=c(mi,aut$max) } plot(mi,ty="l",lwd=2,xlab="",ylab="arg") f=function(theta) {prod(1/(1+(x-theta)^2))} mip=NULL for (i in 1:400){ x=ref[1:i] aut=optimise(f,interval=c(-10,10), maximum=T) mip=c(mip,aut$max) } lines(mip, col="sienna",lwd=2) ############################################################# newton=function(initial.value, num.its) { x=rep(0,10) x[1]=initial.value for (i in 2:10) {
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/04/2011 for the course STAT 531 taught by Professor Gaborlukacs during the Spring '11 term at Manitoba.

Page1 / 2

531f10NR - # # STAT 531 NR # cau = function(x,theta)...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online