Hello,
i'm a beginner and not able to export the full result of a command.
I'm trying to estimate an Ro of the current epidemic.
So, here an example library(R0) epid.count = c(1,1,4,5,8,12,27,38,43,52,66,100) GT.x <- generation.time("gamma", c(2,1.5)) res.R <- estimate.R(epid.count, GT=GT.x, methods=c("EG","ML","SB","TD")) print(res.R)
At this point I'm not able to see all the results.
Reproduction number estimate using Exponential Growth method.
R : 2.287246[ 2.086577 , 2.512827 ]
Reproduction number estimate using Maximum Likelihood method.
R : 1.885677[ 1.622073 , 2.176419 ]
Reproduction number estimate using Time-Dependent method.
3.486779 3.811135 2.458036 2.446274 2.48364 2.521225 1.95077 1.647686 1.631888 1.721446 ...Here Stops
Reproduction number estimate using Sequential Bayesian method.
1 3.05 2.14 2.1 2.02 2.36 2.1 1.81 1.7 1.66 ... Here Stops
I tried to export the results but I can see only wht is already displayed in the Console: cat("Tests Output", file = "tests.txt") capture.output(res.R, file = "tests.txt", append = TRUE)
The documentation for estimate.R says the results for each method are stored in the estimates component of res.R. You can see the structure of that by running
str(res.R$estimates)
If res.R$estimates is a data frame, you can see the results with
View(res.R$estimates)
If res.R$estimates is itself a list then I would guess that the result of each method is stored with a name related to the method, maybe res.R$estimates$EG for exponential growth. So, start with the str() function I mentioned and post the results here if you get stuck.
This is the result of using str(res.R$estimates) for the time-dipendent method (TD).
It actually shows the results but still without the full serie of R (in my example 12).
> str(res.R$estimates$TD) List of 16
$ R : Named num [1:12] 3.49 3.81 2.46 2.45 2.48 ...*
to get your information. If that does not work, then I don't have anything else to suggest other than extracting individual parts of objects like res.R$estimates$TD. I am sorry I can't suggest anything more specific. I am not familiar with this package.