Building Quantile regression in R

Tue Dec 16, 2014 5:36 am

Building a Quantile regression model in R script. Following example show the quantile regression at different quantile values (10%, 25%, 50%, .. 100%). Quantile regression model is important to understand the role of your model varriables along the different percentiles of your data.
Code:
require(foreign) 
require(ggplot2)
require(
MASS)
require(
boot)
# data for analysis model.
data <- read.csv("Model14.csv",head=TRUE );
# attach data
attach(data)
# Define variables
<- cbind(dupdifftriage3)
<- cbind(descriptiontextcount, titletextcount, priority_val, comment_count, cc_count,repoter_rep,bug_severity_num)
<- cbind(titletextcount)
library(quantreg)

# Quantile regression
quantreg10 <- rq(~ X, data=data, tau=0.1)
summary(quantreg10)
quantreg25 <- rq(~ X, data=data, tau=0.25)
summary(quantreg25)

quantreg50 <- rq(~ X, data=data, tau=0.5)
summary(quantreg50)

quantreg75 <- rq(~ X, data=data, tau=0.75)
summary(quantreg75)
quantreg90 <- rq(~ X, data=data, tau=0.90)
summary(quantreg90)
# Simultaneous quantile regression
quantreg2575 <- rq(~ X, data=data, tau=c(0.1, 0.95))
summary(quantreg2575)

# ANOVA test for coefficient differences
anova(quantreg25, quantreg75)

# Plotting data
quantreg.all <- rq(log(Y+1) ~ X, tau = seq(0.05, 0.95, by = 0.05), data=data)
quantreg.plot <- summary(quantreg.all)
plot(quantreg.plot)
 

quantreg
.all <- rq(log(Y+1) ~ z, tau = seq(0.05, 0.95, by = 0.05), data=data)
quantreg.plot <- summary(quantreg.all)
plot(quantreg.plot)





Re: Building Quantile regression in R

Wed Nov 25, 2015 10:44 am

updated.

  Related Posts  to : Building Quantile regression in R
 need help building table in my database!     -  

Topic Tags

R Analysis