Created
May 4, 2018 19:02
-
-
Save timriffe/1a77a1d173e895f0937c2d77d58494a3 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
#mx <- SWE$mx[SWE$Age >= 15 & SWE$Age <= 60 & SWE$Year == 1900] | |
mx <- c(0.00521, 0.00538, 0.00609, 0.00595, 0.00603, 0.00601, 0.00636, | |
0.0057, 0.00653, 0.00672, 0.00659, 0.00689, 0.0052, 0.00669, | |
0.00688, 0.00609, 0.00641, 0.00673, 0.0068, 0.00687, 0.00722, | |
0.00719, 0.00674, 0.00674, 0.00663, 0.00778, 0.00777, 0.00776, | |
0.0076, 0.00834, 0.00722, 0.00865, 0.00675, 0.00987, 0.00948, | |
0.01067, 0.0105, 0.01158, 0.01184, 0.01275, 0.01307, 0.01405, | |
0.0137, 0.01596, 0.01594, 0.01909) | |
plot(15:60, mx, log = 'y',type='l') | |
mavg <- exp(mean(log(mx))) | |
abline(h = mavg, col = "red") | |
# or if you want to weight them by some structure | |
# here random, but you would use the structure of the denominator | |
w <- runif(length(mx)) | |
mavg <- sum(mx * w) / sum(w) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment