# NOT RUN {
data(LocomotorPerfor)
x=log(LocomotorPerfor$Body_Mass)
y=log(LocomotorPerfor$MRRS)
h_ROT = 0.9030372
locpolAND_x0(x, y, p1=1,p2=1,h=h_ROT,alpha=0.50,x0=median(x))
# }
# NOT RUN {
data(LocomotorPerfor)
x=log(LocomotorPerfor$Body_Mass)
y=log(LocomotorPerfor$MRRS)
h_ROT = 0.9030372
locpolAND(x, y, p1=1,p2=1,h=h_ROT, alpha=0.50)
# }
# NOT RUN {
# Data
data(LocomotorPerfor)
x=log(LocomotorPerfor$Body_Mass)
y=log(LocomotorPerfor$MRRS)
h_ROT = 0.9030372
gridPoints=101
alpha= 0.5937
plot(x,y)
# location and scale functions estimation at the grid point x0
gridPoints=101
fit_AND <-locpolAND(x, y, p1=1,p2=1,h=h_ROT, alpha=alpha, m = gridPoints)
par(mgp=c(2,.4,0),mar=c(5,4,4,1)+0.01)
# For phi plot
plot(fit_AND$x0,exp(fit_AND$theta_20),ylab=expression(widehat(phi)(x[0])),
xlab="log(Body mass)",type="l",font.lab=2,cex.lab=1.5,
bty="l",cex.axis=1.5,lwd =3)
## For theta2 plot
plot(fit_AND$x0,fit_AND$theta_20,ylab=expression(bold(widehat(theta[2]))(x[0])),
xlab="log(Body mass)",type="l",col=c(1), lty=1, font.lab=1,cex.lab=1.5,
bty="l",cex.axis=1.3,lwd =3)
par(mgp=c(2.5, 1, 0),mar=c(5,4,4,1)+0.01)
# X11(width=7, height=7)
plot(x,y, ylim=c(0,4.5),xlab = "log(Body mass (kg))",
ylab = "log(Maximum relative running speed)",font.lab=1.5,
cex.lab=1.5,bty="l",pch=20,cex.axis=1.5)
lines(fit_AND$x0,fit_AND$theta_10, type='l',col=c(4),lty=6,lwd =3)
lines(fit_AND$x0,SemiQRegAND(beta=0.50,x, y,
p1=1,p2=1, h=h_ROT,alpha=alpha,m=gridPoints)$fit_beta_AND,
type='l',col=c(1),lty=5,lwd =3)
lines(fit_AND$x0,SemiQRegAND(beta=0.90,x, y,
p1=1,p2=1, h=h_ROT,alpha=alpha,m=gridPoints)$fit_beta_AND,type='l',col=c(14),lty=4,lwd =3)
lines(fit_AND$x0,SemiQRegAND(beta=0.10,x, y,
p1=1,p2=1, h=h_ROT,alpha=alpha,m=gridPoints)$fit_beta_AND,type='l',
col=c(19),lty=2,lwd =3)
legend("topright", legend = c(expression(beta==0.10),
expression(beta==0.50), expression(beta==0.5937),
expression(beta==0.90)), col = c(19,1,4,14), lty=c(2,5,6,4),
adj = c(.07, 0.5),, inset = c(0.05, +0.01), lwd = 3,cex=1.2)
# }
Run the code above in your browser using DataLab