You need to store your results in a list and then access the
information in the list to get the values:
> boot<-function(a,b,c){
+ media<-(a+b+c)/3
+ var_app<-var(a)
+ list(media=media,var_app=var_app)
+ }
> boot(2,4,10)
$media
[1] 5.33
$var_app
[1] NA
>
> simul<-function(S){
+
On Aug 17, 2009, at 1:40 PM, MarcioRibeiro wrote:
Ok, the LIST function I understood...
I didn't see how you got a "random" input to that function. Would seem
to need one of the r functions as input.
What I would like now is to simulate this Function A many times (S)
in order
to get S
Hi listers,
I've been looking for a procedure, but I am not succeding...
I have a function that give multiple results...
Then, I would like to simulate this function n times, so I need to save/keep
the n multiple results, in order to calculate my desired statistics...
I have already tried with the
Ok, the LIST function I understood...
What I would like now is to simulate this Function A many times (S) in order
to get S results for the MEAN and for the VARIANCE...
Zhiliang Ma wrote:
>
> in order to return more multiple variables, you can put them in a list
> and then return this list.
>
in order to return more multiple variables, you can put them in a list
and then return this list.
e.g.
#Function A
boot<-function(a,b,c){
mean_boot<-(a+b)/2
var_boot<-c
list(mean_boot = mean_boot, var_boot = var_boot)
}
out <- boot(1,2,3)
out
$mean_boot
[1] 1.5
$var_boot
[1] 3
On Fri, Aug 1
Hi listers,
I am working on a simulation... But I am having some troubles...
Suppose I have a function A which produces two results (mean and
variance)...
Then I would like to simulate this function A with a function B many times
using the results from function A
For example:
#Function A
boot<-fu
6 matches
Mail list logo