Dave learns R: first plot

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
813 views
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jan 21, 2012

I am teaching myself R. My first goal is to plot the price-yield curve of a 10-year zero coupon bond, so I need to define the price function, and apply (i.e., lapply) the function to each element in a vector of yields. For my first step, this is a lot of fun. Very intuitive!

Category:

Education

Tags:

License:

Standard YouTube License

Link to this comment:

Share to:

Uploader Comments (bionicturtledotcom)

  • But still: very helpfull video so thanks for that!

  • @Riverdale270 thanks!

  • Hi, another great video. Your code can be simplified. You can use "=" istead of "<-" but sometimes it is more convenient to use "<-". Tor time series plot there is a useful "ts.plot" funtion.

    bp = function(y) 100*exp(-y*10)

    ts.plot(bp(seq(0,.1,.01)))

    G

  • @smicha7 oh, ts.plot() works! even though it's not a timeseries. This is fantastic, i'm actually learning from youtube. I wanted to use "=" but <-. You can also use =, but I read "[equal sign] is discouraged, as it does not work in some special situations. Norman Matloff, The Art of R Programming

  • @bionicturtledotcom @bionicturtledotcom Yes, your example is scatter plot - sorry for this. Also if you are looking for any help type help.search("your word"). And maybe this might help, just google Farnsworth-EconometricsInR and choose first link.

  • @smicha7 oh, thank you for help.search(), i will be using that! yes, i realize it's technically a scatter but your ts.plot() works

see all

All Comments (17)

Sign In or Sign Up now to post a comment!
  • As a MATLAB user I can without doubt say that this would be much more intuitive in MATLAB, which is an often stated advantage of MATLAB. However, if you're used to something, I guess that's what works best for you. But I'm only going to let MATLAB go if I really can't find what I'm looking for (not that likely) or if R or another package provides a package I need and MATLAB does not have that package... (not very likely either... but you never now). Not all econometrics is in MATLAB so we'll see

  • @smicha7 Sorry, it is a scatter plot, not time series.

  • R! Good idea, thank you! I have been wanting to get into R for some time.

  • @cwaddle I just opened it so i can't say yet, i have similar questions. I sort of can already see why R is popular in Big Data. IMO Excel is not really great for large data sets. I don't know about R graphing yet (mathematica is really strong there), but i think Excel is lame for graphing anything except the basics.

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more