How to find and plot Implied volatility in R - r

I'm writing because I want to find and plot implied volatility to the BS model using R. However, I'm not used to coding in R and I honestly don't know where to start so I wanted to ask if anyone on this forum has written such a code in R and therefor maybe could bed able to help me?
Thanks a lot!
Edit: I see I may have offended a few people by simply asking for code. I apologize for that. All I perhaps need to ask is where people on this forum usually get financial data to use in R from?
Mads

Posted by: Renato Vitolo
Quantitative risk analyst at Banca Monte dei Paschi di Siena
Error handling is not stupendous, I ought to admit, but it's past bedtime. Try this from an R terminal:
source(url("http://empslocal.ex.ac.uk/people/staff/rv211/BS/BS-Newton.R"))
Example 1: data taken from http://www.maxi-pedia.com/Black+Scholes+model
Example 2: data taken from http://voices.yahoo.com/the-black-scholes-formula-practice-problems-solutions-1297845.html?cat=4

Related

R -Eye Tracking packages for SMI's BeGaze users

Currently, we are working on an eye-tracking study and we are not quite satisfied with the analysis option of SMI’s BeGaze. Hence, I would like to ask you know good way to extract data from BeGaze, which can be processed by a handy R-package, which is still working under R 3.6.1 – not like ETRAN.
It would be great to do add AOIs manually, do heat maps, analyze saccades, fixation times, and ratios between AOIs.
We came across eyetrackingR, but we are still struggling with extracting BeGaze's data in a processable way.
Any help, tutorial, hint, etc. is much appreciated.
David

R - replicate weight survey

Currently I'm interested in learning how to obtain information from the American Community Survey PUMS files. I have read some of the the ACS documentation and found that to replicate weights I must use the following formula:
And thanks to google I also found that there's the SURVEY package and the svrepdesign function to help me get this done
https://www.rdocumentation.org/packages/survey/versions/3.33-2/topics/svrepdesign
Now, even though I'm getting into R and learning statistics and have a SQL background, there are two BIG problems:
1 - I have no idea what that formula means and I would really like to understand it before going any further
2 - I don't understand how the SVREPDESIGN function works nor how to use it.
I'm not looking for someone to solve my life/problems, but I would really appreciate if someone points me in the right direction and gives a jump start.
Thank you for your time.
When you are using svyrepdesign, you are specifying that it is a design with replicated weights, and it uses the formula you provided to calculate the standard errors.
The American Community Survey has 80 replicate weights, so it first calculates the statistic you are interested in with the full sample weights (X), then it calculates the same statistic with all 80 replicate weights (X_r).
You should read this: https://usa.ipums.org/usa/repwt.shtml

STFDF vs. STARIMA

I'm working on spatio-temporal anomaly analysis using R.
I found a lot tutorials talking about converting data into STFDF( space-time full data frame) and use variogram method and then use stkrige function for prediction. And so I did. However, I found some research papers talking about STARIMA model , which is basically, ARIMA model but for space time data.
Couldn't find any example how to implement it using R.
Does anyone have an idea how to implement it?
Also, how does STARIMA is related to variogram?
The reason why I'm asking is because when I used variogram and pull the plot for the time series of my data, I see outliers, and I couldn't find tutorials explains how to detect outliers with variogram. Anyone went through this topic before?
Thanks

Markov Switching-Autoregressive in R

I'm trying to replicate this paper but using different time period
https://www.dropbox.com/s/edwdpgwsbli93f1/SM35%282%29-09-modelling.pdf?dl=0.
This paper is about detecting regime shifts in Malaysian currency i.e the ringgit. From what I understand it uses Markov Switching-Autoregressive method (MS-AR). I've been trying to replicate this method in R, but to no success. There has been some question asking about it lately which can be found here
Error when using msmFit in R
Basically I'm having the same problem. When I tried to do the MS-AR the error came out. I'm not sure what the exact calculation for the msmFit, but from some examples online they use this to get the fit for MS-AR. So my question is, is it actually possible to do MS-AR(p) in R? Is there any other software besides R or Eviews 8 (since I don't have this at the moment) that can actually do this?
Thank you. Really appreciate your insight.
link msmFit: http://cran.r-project.org/web/packages/msm/msm.pdf
There is a package for MATLAB called MS_Regress, it should do the job:
https://sites.google.com/site/marceloperlin/matlab-code/ms_regress---a-package-for-markov-regime-switching-models-in-matlab
I was trying to fit the MS-AR model in R, but I get the same error message. Could you provide us with a link to the examples you found about getting the fit in R?

Need help in R for coding equations

I'm pretty new to using R and I am certainly unsure on how to plug in and graph equations. For an example I have to plot the Goldmann-Hodgkin-Katz equation
(since my reputation is too low I can't send a nice equation so here's a link)
http://www.cnbc.cmu.edu/~bard/passive2/node3.html
This is for a neuroscience class and I'm pretty savvy with coding in java but struggle with terminal based languages.
Thanks for all your help!
To get started, check out http://stat.ethz.ch/R-manual/R-devel/library/graphics/html/curve.html.
Here is an example:
curve(3*x^2 + 2)

Resources