Change Variable Labels in Quantile Plot

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Change Variable Labels in Quantile Plot

Kitty Lee
Hi Roger,

Maybe I'm missing a clue. Here's an example:

x<-rnorm(50)
x1<-rnorm(50)
y<-x+x1+rnorm(50)


out<-rq(y~x+x1, tau=1:9/10)
plot(summary(out))
plot.out<-plot(summary(out))


#I change the variable names

dimnames(plot.out)<-list(c("intercept", "sex", "inc"))


#Look at the plot
#it's ONE simple scatter plot


plot(plot.out)

#my plot.out looks like this, with my new variable names:

 plot.out
, , 1

                [,1]       [,2]       [,3]
intercept -0.9684998 -1.3451267 -0.8554466
sex        1.3024216  0.9792294  1.5194859
inc        1.0489889  0.9384161  1.3646852

, , 2

               [,1]       [,2]       [,3]
intercept -0.847599 -0.9249002 -0.7031141
sex        1.196264  1.0679468  1.5565114
inc        1.051680  0.9290777  1.1418159

, , 3

                [,1]       [,2]       [,3]
intercept -0.6193228 -0.8068516 -0.3450270
sex        1.3516443  1.1346039  1.4960807
inc        1.1004782  0.9464957  1.3019890

, , 4

                [,1]       [,2]       [,3]
intercept -0.3495659 -0.6624029 -0.1704943
sex        1.3275109  1.0464328  1.6142684
inc        1.2490575  0.8875538  1.4025895

, , 5

                [,1]       [,2]      [,3]
intercept -0.1784042 -0.3573525 0.1754451
sex        1.2470905  0.9892965 1.6886048
inc        1.2935877  0.8582333 1.4674911

, , 6

              [,1]       [,2]      [,3]
intercept 0.183886 -0.1750720 0.4530025
sex       1.138229  0.9741906 1.7244919
inc       1.278752  0.5375699 1.4083399

, , 7

               [,1]      [,2]      [,3]
intercept 0.4684853 0.1773750 0.7221706
sex       1.0531324 0.8957021 1.5703037
inc       1.1568603 0.8247799 1.4793218

, , 8

               [,1]      [,2]     [,3]
intercept 0.7130231 0.4917459 1.066634
sex       1.1240660 0.7189979 1.643119
inc       0.9174367 0.5515194 1.471176

, , 9

               [,1]      [,2]     [,3]
intercept 1.4878010 0.7862083 1.697887
sex       0.6897668 0.6594517 2.833151
inc       0.7784398 0.4176534 1.693811

, , 10

                  [,1]       [,2]      [,3]
intercept -0.007821782 -0.2306475 0.2150039
sex        1.254127945  1.0105681 1.4976878
inc        1.127927628  0.8774788 1.3783765



Now I have the right variable names but I can't produce the  right plots. How do I integrate your code?


plot(plot.out, xlab='foo', ylab='bar)


Thanks.

k.


______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Change Variable Labels in Quantile Plot

RKoenker
<quote author="Kitty Lee">
Hi Roger,

Maybe I'm missing a clue. Here's an example:

x<-rnorm(50)
x1<-rnorm(50)
y<-x+x1+rnorm(50)


out<-rq(y~x+x1, tau=1:9/10)
plot(summary(out))
plot.out<-plot(summary(out))


#I change the variable names

dimnames(plot.out)<-list(c("intercept", "sex", "inc"))


Why not just change the names of the variables before invoking the call to rq, and its formula?