16. [R] Tutorial Jan 26

# 16. [R] Tutorial Jan 26 - x.old=4*mean(data.sim x.old...

This preview shows pages 1–3. Sign up to view the full content.

#alpha=.5 F.inv=function(x) sqrt(1+8*x)-2 data.sim = F.inv(runif(10000)) g=function(x) sum(data.sim/(1+data.sim*x)) g.der=function(x) -sum(data.sim^2/(1+data.sim*x)^2) ite=function(x) x-g(x)/g.der(x) x.old=3*mean(data.sim) x.old x.new=ite(x.old) n=1 while(abs(x.new-x.old)>1e-6){ x.old=x.new x.new=ite(x.old) n=n+1 } x.new n

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

View Full Document
#alpha=.5 F.inv=function(x) sqrt(1+8*x)-2 data.sim = F.inv(runif(10000)) g=function(x) sum(data.sim/(1+data.sim*x)) g.der=function(x) -sum(data.sim^2/(1+data.sim*x)^2) ite=function(x) x-g(x)/g.der(x)
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: x.old=4*mean(data.sim) x.old x.new=ite(x.old) n=1 while(abs(x.new-x.old)>1e-6){ x.old=x.new x.new=ite(x.old) n=n+1 } x.new n #alpha=.5 F.inv=function(x) sqrt(1+8*x)-2 data.sim = F.inv(runif(10000)) g=function(x) sum(data.sim/(1+data.sim*x)) g.der=function(x)-sum(data.sim^2/(1+data.sim*x)^2) ite=function(x) x-g(x)/g.der(x) x.old=10*mean(data.sim) x.old x.new=ite(x.old) n=1 while(abs(x.new-x.old)>1e-6){ x.old=x.new x.new=ite(x.old) n=n+1 } x.new n...
View Full Document

## This note was uploaded on 01/17/2012 for the course AM 1234 taught by Professor Qqqq during the Spring '11 term at UWO.

### Page1 / 3

16. [R] Tutorial Jan 26 - x.old=4*mean(data.sim x.old...

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

View Full Document
Ask a homework question - tutors are online