Question

Stat 255 Project 3 due Wednesday, April 22 Write R code to solve the following problems, Make sure to include descriptions an

I am just wanting the first question answered.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1.

Below is R code for the simulating function.

simulating = function(S0, mu, sigma, N) {
S = c(S0) #create initial vector
Sj = S0 #Initialize Sj
for(j in 1:N) { #Compute Sj for all values 1..N
Sj = Sj * exp(mu - sigma^2/2 + sigma * rnorm(1))
S = c(S, Sj) #Append Sj to vector S
}
return(S)
}

On running the command, simulating(1, 0.1, 0.2, 10), we get below output,

> simulating(1, 0.1, 0.2, 10)
[1] 1.0000000 1.8433066 1.9675347 1.9523594 1.7156607 1.0143739 1.0405305 0.9748322 1.1869636 1.1838510
[11] 1.4178485

Add a comment
Know the answer?
Add Answer to:
Stat 255 Project 3 due Wednesday, April 22 Write R code to solve the following problems, Make sur...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT