<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px"><div><span></span></div><div></div><div id="yui_3_16_0_1_1443210128170_5066"> </div><div class="signature" id="yui_3_16_0_1_1443210128170_5067"><div id="yiv9483584114yui_3_16_0_1_1443124974466_3271" class="">Olá pessoal tudo bem.</div><div id="yiv9483584114yui_3_16_0_1_1443124974466_3271" class=""><br clear="none" id="yiv9483584114yui_3_16_0_1_1443124974466_4737" class=""></div><div id="yiv9483584114yui_3_16_0_1_1443124974466_3271" class="">Estou trabalhando com a regressão quantilica. Abaixo segue um exemplo. Porém gostaria que a aproximação fosse por splines. Como posso fazer isso?</div><div id="yiv9483584114yui_3_16_0_1_1443124974466_3271" class=""><br clear="none" id="yiv9483584114yui_3_16_0_1_1443124974466_4741" class=""></div><div id="yiv9483584114yui_3_16_0_1_1443124974466_3271" class=""><br clear="none" id="yiv9483584114yui_3_16_0_1_1443124974466_4744" class=""></div><div id="yiv9483584114yui_3_16_0_1_1443124974466_3271" class=""><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271"><br></div><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271"><br></div><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271">set.seed(1)</div><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271"><br clear="none" class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3352"></div><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271">n <- 500</div><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271">x <- floor(runif(n, 18, 80))</div><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271">y <- 5*x - 0.05*x^2 + rnorm(n, mean=0, sd=10*sqrt(x))</div><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271">plot(x, y)</div><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271">taus <- 1:9/10</div><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271"><br clear="none" class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3360"></div><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271">library(quantreg)</div><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271">modelo <- rq(y ~ x , tau=taus)</div><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271"><br clear="none" class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3365"></div><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271">valoresPreditos <- predict(modelo)</div><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271"><br clear="none" class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3369"></div><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271">dadosGraficos <- data.frame(valoresPre = as.numeric(valoresPreditos), </div><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271"> tau = as.factor(rep(taus, each=n)),</div><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271"> x = rep(x, times=length(taus)))</div><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271"><br clear="none" class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3375"></div><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271">library(ggplot2)</div><div class="" id="yiv9483584114yui_3_16_0_1_1443124974466_3271">g <- ggplot(unique(dadosGraficos), aes(x=x, y=valoresPre, group=tau)) + theme_bw()</div><div class="" dir="ltr" id="yiv9483584114yui_3_16_0_1_1443124974466_3271">g + geom_line(aes(linetype=tau))</div><div class="" dir="ltr" id="yiv9483584114yui_3_16_0_1_1443124974466_3271"><br clear="none" id="yiv9483584114yui_3_16_0_1_1443124974466_4773" class=""></div><div class="" dir="ltr" id="yiv9483584114yui_3_16_0_1_1443124974466_3271"><br clear="none" id="yiv9483584114yui_3_16_0_1_1443124974466_4776" class=""></div><div class="" dir="ltr" id="yiv9483584114yui_3_16_0_1_1443124974466_3271"><br clear="none" id="yiv9483584114yui_3_16_0_1_1443124974466_4779" class=""></div><div class="" dir="ltr" id="yiv9483584114yui_3_16_0_1_1443124974466_3271">Abaixo em anexo segue uma imagem do que realmente gostaria de visualizar. Como poderia fazer isso no R?</div><div class="" dir="ltr" id="yiv9483584114yui_3_16_0_1_1443124974466_3271"><br clear="none" id="yiv9483584114yui_3_16_0_1_1443124974466_4783" class=""></div><div class="" dir="ltr" id="yiv9483584114yui_3_16_0_1_1443124974466_3271">Obrigado </div><div dir="ltr" id="yui_3_16_0_1_1443210128170_5122" class=""><br id="yui_3_16_0_1_1443210128170_5124" class=""></div></div></div></div></body></html>