[R] How to do a target value search analogous to Excel Solver

2011-11-07 Thread jolo999
Hi all,

i'm trying to find a solver possibility analogous to the Excel Solver in R.
Since i just started with R, I have only little knowledge. Can someone help
me by solving the problem?

I have the following 'starting position':

z = rnorm(1,0,1)
y <- function(x,z){2*x - 1 + z}

I am looking for a certain "x" in such a way that the result of the function
'y' equals 5.5

Thanks a lot!

--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-do-a-target-value-search-analogous-to-Excel-Solver-tp3998347p3998347.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


Re: [R] How to do a target value search analogous to Excel Solver

2011-11-07 Thread jolo999
Works fine. Thanks for the quick reply!!

--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-do-a-target-value-search-analogous-to-Excel-Solver-tp3998347p3998729.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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.


[R] Counting the loop-round of a "for"-loop

2012-02-12 Thread jolo999
Dear all,

i have daily stock prices for more than 10 years and want to compute annual
volatilities for certain dates during this period.  Since i have found no
"easy" way to work with time data, the data presents itself in the structure

TIme Index - Stock Price
1 - 15,6
2 - 17
...
...
2010 - 28
2011- 28,5
...
4500 - 23

Since I want to have the volatility only for certain dates, I define these
dates in a vector

Deal_Dates <- c(500,600,700,805)  

and use the for-command to calculate these specific volatities via 

for(i in Deal_Dates){Volatility(i)}

My problem is now, that I want to save the results in a new matrix which i
created in the structure

results <- matrix(rep(NA,4*2),4,2) in a way that

Time Index - Volatility
500 - 0.55
600 - 0.44
700 - 0.45
805 - 0.66
is stored in the results matrix.

How can I save the result of each for-loop  in the matrix? I want the
respective Time-Index of the loop to be put in the first column and the
volatility in the second column. Since my vector for the for-loop consists
of "random" values for the Time-Index, i can't write

resultsl[i,1] = Time Index and
results[i,2] = Volatility

I am looking for something that gives me the current round or iteration of
the for-loop in order to replace the "i" in adressing the cells of the
result matrix.

Hope you can help!


--
View this message in context: 
http://r.789695.n4.nabble.com/Counting-the-loop-round-of-a-for-loop-tp4381319p4381319.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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.


Re: [R] Counting the loop-round of a "for"-loop

2012-02-12 Thread jolo999
It seems to work. Simple and effective!

Thanks!

--
View this message in context: 
http://r.789695.n4.nabble.com/Counting-the-loop-round-of-a-for-loop-tp4381319p4381780.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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.


[R] Package "demography" - calculating quintiles of survival probabilities

2012-04-20 Thread jolo999
Hi,


I am using the package "demography" from Rob Hyndman for the
Lee-Carter-Model. It is an amazing powerful tool but I am struggling with
one issue: 


*I want to compute different quintiles for the cumulative survival
probability derived from the Lee-Carter-Forecast (e.g. the 50%-quintile,
75%-quintile and 99%-quintile) for the next 10 years. * 


I am sure the package possess this functionality but I didn't find any way
to calculate quintile values.


Hope you can help me!


Thanks

Jonas

--
View this message in context: 
http://r.789695.n4.nabble.com/Package-demography-calculating-quintiles-of-survival-probabilities-tp4573570p4573570.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


[R] Package "demography" - calculating percentiles of survival probabilities distribution

2012-04-20 Thread jolo999
Hi,

I am using the package "demography" from Rob Hyndman for the
Lee-Carter-Model. It is an amazing powerful tool but I am struggling with
one issue:

I want to compute different percentiles of the survival probability
distribution derived from the Lee-Carter-Forecast (e.g. the 50%tile,
60%tile, 75%tile and 99%tile) for each of the next 10 years. Is there any
possibility to retrieve these "attachment points"?

I am sure the package possess this functionality but I didn't find any way
to calculate percentile values.

Hope you can help me!

Thanks

Jonas 

--
View this message in context: 
http://r.789695.n4.nabble.com/Package-demography-calculating-percentiles-of-survival-probabilities-distribution-tp4575145p4575145.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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.


Re: [R] Package "demography" - calculating percentiles of survival probabilities distribution

2012-04-21 Thread jolo999
Hi David,

thanks for your patience and your comment. Unfortunately, your code - if I
understood it correctly - is still not what I am looking for. I try to
describe an example as you suggested:

I assume that the Lee-Carter-Forecast-Modell generates different sample
paths or simulation runs, e.g. 1000 simulations. Within each simulation, a
mortality table is generated for all covered ages (0-100 in my case) and a
forecast period for x years.

What I am looking for is a possibility to extract percentiles from these
sample paths or simulations, for example:

What is the 50%tile (or 75%tile, 80%tile, 95%tile etc.) survival probability
of a (for example) 65 year old person in the first forecast year (FCY1)
based on the 1000 simulations or sample paths.

Now I want to let this 65 year old person age for the next 10 years that
means

--> What is the 50%ile (or 75%tile, 80%tile, 95%tile etc.) survival
probability of a 66 year old person in FCY2
--> What is the 50%ile (or 75%tile, 80%tile, 95%tile etc.) survival
probability of a 67 year old person in FCY3
--> What is the 50%ile (or 75%tile, 80%tile, 95%tile etc.) survival
probability of a 68 year old person in FCY4
... and so on.

Sorry, I dodn't know better to describe my problem. Hope you can help!

Thanks in advance and have a nice weekend!

Best
Jonas

--
View this message in context: 
http://r.789695.n4.nabble.com/Package-demography-calculating-percentiles-of-survival-probability-distribution-tp4575145p4576203.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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.