[R] reading simulations

Peter Ehlers ehlers at ucalgary.ca
Sat Feb 19 20:32:15 CET 2011


On 2011-02-19 07:35, garciap wrote:
>
> Hi to all the people (again),
>
> I'm doing some simulations with the memisc package of an own function, but
> I've the problem that I didn't know how to read the result of such
> simulations. My function is:
>
>> Torre<-function(a1,N1,a2,N2)
> + {Etorre<-(a1*N1)/(1+a1*N1)
> + Efuera<-(a2*N2)/(1+a2*N2)
> + if(Etorre>Efuera)Subir=TRUE
> + if (Etorre<Efuera)Subir=FALSE
> + result<-list(Subir)
> + return(result)
> + }
>
>> Torre<-Simulate(Torre(a1,N1,a2,N2),expand.grid(a1=3,N1=0.5,a2=c(0.01,0.02,0.05,0.1),N2=0.1),nsim=1000,seed=10000,trace=50,keep.data=TRUE)
>

[... snip ...]

>> print(Torre)
> A 'default_bucket' object with 5 variables and 4000 observations
>
> When I try print the results I obtain this, but how can I read it? It will
> seem stupid to people, but I can't! even though function summary(Torre):
>
>> summary(Torre)
> Error in object[[i]] : wrong arguments for subsetting an environment
>>

You should be able to wrap your Simulate output in as.data.frame:

  dat <- as.data.frame(Simulate(....))

Peter Ehlers

>
>
> Best regards (again) and many thanks for your help
>
> Pablo



More information about the R-help mailing list