Created
July 22, 2019 14:13
-
-
Save koushikkhan/ba1e3719ab417fe14be85d33ac894c3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LogNormalSimulator <- R6Class("LogNormalSimulatorClass", | |
inherit = GaussianSimulator, | |
public = list( | |
log_normal_sample = NA, | |
initialize = function(mu, sigma, n_sample) { | |
super$initialize(mu = mu, sigma = sigma, n_sample = n_sample) | |
}, | |
generate_lognormal_sample = function() { | |
normal_sample <- self$generate_sample() | |
self$log_normal_sample <- exp(normal_sample) | |
return (self$log_normal_sample) | |
}, | |
compute_stats = function() { | |
# Computes basic statistics of the sample | |
r <- list(sample.mean = mean(self$log_normal_sample), | |
sample.sd = sd(self$log_normal_sample)) | |
return (r) | |
} | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment