[Patrick Donovan](http://www.twitter.com/donovanscience) put out a tweet the other day with a screenshot to a Chrome extension he had just put together. It caught my attention and led to this post because it’s a really, really good idea.
Got my Chrome Extension created, now to refine and then publish to our organization. Thank you @curt_truc #COL16 pic.twitter.com/HosZU52r2t
— Patrick Donovan (@donovanscience) July 22, 2016
I tracked down [Curt Schleibaum](http://www.twitter.com/curt_truc) whose [website](http://www.geekyedtech.com) included a demo to his Chrome extension idea. In short, he provided a template which included all of the necessary files to have a simple popup Chrome browser extension. It was quite clever – instead of having the user change code for the extension to push information, it had an embedded Google Doc that you use updated with new information. It also included links back to the district website, tech support, etc.
It got me thinking about how the extension could be improved, so that’s what I put together last night. [The source is on GitHub](https://github.com/bennettscience/announcements) so you can see the nitty gritty. My extension builds on Curt’s original idea – allowing a teacher or admin to use a Google service to push announcements out to extension users. Instead of a document, mine uses a spreadsheet and watches for an update to publish and then badges the extension when new information is available.
If you want to play with this yourself, follow the steps below (mostly proof-of-concept at this point, lots of refining to do).
Google spreadsheets are your friend. The best thing, in my opinion, is that they publish in multiple formats when you publish one to the web (this is different than **sharing**). One of those formats is JSON, which is a _great_ way to take a lot of data, organize it, and then display that information nicely in another application.
[Grab this template spreadsheet](https://docs.google.com/spreadsheets/d/10j8Ycax02XMkVWMK1v-aYJMHoOjQaLRFuZUOKZEY9nA/copy) and save a copy to your Drive. Then, go to File > Publish to the web and publish it with all the default settings.
The extension is a collection of JavaScript files and a `popup.html` file. The JS does all the magic with the spreadsheet JSON data and the HTML displays it nicely in the Chrome browser. The JS will also ping the spreadsheet every few minutes to see if there have been updates. If there was an update made, a badge notification will appear on the extension icon. Sweet.
The easiest way to do this is to download the extension and load it locally on your machine. To do that, [open the project on GitHub](http://www.github.com/bennettscience/announcements) and click on “Clone or download” on the right side of the screen. Unzip the file that downloads.
Next, go to `chrome:extensions` and make sure “Developer Mode” is checked. Once it’s checked, you can click on, “Load unpacked extension” and select the folder you just unzipped.
The extension needs one more thing: *the spreadsheet key*. Go back to the template spreadsheet and grab the jumble of letters and numbers that come after
`https://docs.google.com/spreadsheets/d/`
and before `edit` in the URL. An example URL would be,
`https://docs.google.com/spreadsheets/d/THE_SPREADSHEET_KEY_IS_HERE/edit`
. When you click on the extension icon the first time, you’ll be prompted to copy and paste that spreadsheet key into the box. Now, you’re good to go!
To test the extension, go back to your spreadsheet template and add some data. Give it a minute or two and, hey presto! Your extension will update with the information you just entered.
Most schools are using some kind of learning management system which includes a messaging app. If you’re not, this would be a good way to talk with your students (maybe). In our case, we’re looking at using this as a rapid-push service to notify teachers and other staff about upcoming professional learning, system outages, or other announcements that need to be sent, but don’t need an email. It’s definitely an experimental project, but one I’m curious to play with some more.
Written on August 5th, 2016 by Brian Bennett Categorized in: All Technology
Leave a comment


this is bold
ths is italic.
This is both bold and italic
this is underlined
link
this is a big p-tag


Chapter 4 Collective Risk Model
Mathematical models of the total amount of claims from a portfolio of policies over a short period of time will be presented in this chapter. The models are referred to as short term risk models. Two main sources of uncertainty including the claim numbers and claim sizes will be taken into consideration. We will begin with the model for aggregate (total) claims or collective risk models.
We define the following random variables:
\(S\) denotes total amount of claims from a portfolio of policies in a fixed time interval, for e.g. one year,
\(N\) represents the number of claims, and
\(X_i\) denotes the amount of the \(i\)th claim.
Then the total claims \(S\) is given by \[S = X_1 + \ldots + X_N.\]
The following assumptions are made for deriving the collective risk model:
\(\{X_i \}_{i=1}^\infty\) are independent and identically distributed with distribution function \(F_X\).
\(N\) is independent of \(\{X_i \}_{i=1}^\infty\).
The distribution of the total claim \(S\) is said to be a compound distribution. The properties of the compound distribution will be given in the Section 2.
Note The distribution of \(S\) can be derived by using convolution technique. In general, the closed form expressions for the compound distribution do not exist so we will mainly concern with the moments of \(S\). For more details about convolution, see Gray and Pitts (2012).
4.1 Conditional expectation and variance formulas
Some useful properties of conditional expectation and conditional variance are given. The conditional expectaion formula is
\[E[ E[X|Y ]] = E[X].\] The conditional variance of \(X\) given \(Y\) is defined to be \[\begin{split} Var[X|Y] &= Var[Z] \text{ where } Z = X|Y \\ &= E[(Z - E[Z])^2] = E[Z^2] - (E[Z])^2 \\ &= E[(X - E[X|Y])^2 | Y] \\ &= E[X^2| Y] - (E[X|Y])^2. \\ \end{split}\] The conditional variance formula is \[\begin{equation} \tag{4.1} Var[X] = E[ Var[X|Y ]] + Var[E[X|Y ]]. \end{equation}\]
Example 4.1 Show that \[Var[X] = E[ Var[X|Y ]] + Var[E[X|Y ]].\]
Solution:
Consider the terms on the right-hand side of (4.1). We have
\[\begin{aligned} E[Var[X|Y]] &= E\left[ E[X^2|Y] - (E[X|Y])^2 \right] \\ &= E[X^2] - E\left[(E[X|Y])^2 \right], \end{aligned}\] and \[\begin{aligned} Var[E[X|Y ]] &= Var[Z] \text{ where } Z = E[X|Y ] \\ &= E[(E[X|Y ])^2] - (E[E[X|Y ]])^2 \\ &= E[(E[X|Y ])^2] - (E[X])^2 \\ \end{aligned}\] Adding both terms gives the required result.
Example 4.2 In three coloured boxes - Red, Green and Blue, each box has two bags. The bags of Red box contain 1 and 2 (in units of THB) respectively, those of Green box contain 1 and 5, and those of Blue contain 1 and 10 . A box is chosen at random in such a way that \(\Pr(\text{Red}) = \Pr(\text{Green}) = \Pr(\text{Blue}) = 1/3\). A fair coin is tossed to determined which bag to be chosen from the chosen box. Let \(X\) be the value of the contents of the chosen bag.
Find the distribution of \(X\).
Find \(E[X]\) and \(Var[X]\).
Use the conditional expectation and conditional variance formulas to verify your results.
Solution: 1. The distribution of \(X\) can be obtained by using the law of total probability: for example \[\begin{aligned} P(X= 1) &= P(X = 1 , R) + P(X = 1 , G) + P(X = 1 , B) \\ &= P(X = 1 | R) \cdot P(R) + P(X = 1 | G) \cdot P(G) + P(X = 1 | B) \cdot P(B) \\ &= \frac{1}{2} \cdot \frac{1}{3} + \frac{1}{2} \cdot \frac{1}{3} + \frac{1}{2} \cdot \frac{1}{3} = \frac{1}{2}. \end{aligned}\] Similarly, we have \[P(X = 1 ) = \frac{1}{2}, \quad P(X = 2 ) = P(X = 5 ) = P(X = 10 ) = \frac{1}{6}.\]
It follows that \[E[X] = \frac{10}{3}, \quad Var[X] = \frac{98}{9}.\]
We first calculate \[\begin{aligned} E[X|R] &= \frac{1}{2}\cdot(1 + 2) = \frac{3}{2} \\ E[X|G] &= \frac{1}{2}\cdot(1 + 5) = 3 \\ E[X|B] &= \frac{1}{2}\cdot(1 + 10) = \frac{11}{2}. \\ \end{aligned}\] We have \[\begin{aligned} E[X] &= E[X | R] \cdot P(R) + E[X | G] \cdot P(G) + E[X | B] \cdot P(B) \\ &= \frac{1}{3}\cdot(\frac{3}{2} + 3 + \frac{11}{2}) = \frac{10}{3}. \end{aligned}\]
4.2 The moments of a compound distribution \(S\)
The moments and moment generating function of \(S\) can be easily derived from the conditional expectation formula.
4.2.1 The mean of \(S\)
Let \(m_k\) be the \(k\)th moment of \(X_1\), i.e. \(E[X_1^k] = m_k\). Conditional on \(N = n\), we have \[E[S | N = n] = E[ \sum_{i=1}^n X_i] = \sum_{i=1}^n E[ X_i] = n E[ X_i] = n \cdot m_1.\] Hence, \(E[S | N] = N m_1\) and \[E[S] = E[E[S | N]] = E[N m_1] = E[N] m_1 = E[N] \cdot E[X_1].\] It is no surprise that the mean of the total claims is the product of the means of the number of claims and the mean of claim sizes.
4.2.2 The variance of \(S\)
Using the fact that \(\{X_i \}_{i=1}^\infty\) are independent, we have \[Var[S | N = n] = Var[ \sum_{i=1}^n X_i] = \sum_{i=1}^n Var[ X_i] = n Var[ X_i] =n (m_2 - m_1^2),\] and \(Var[S | N] = N (m_2 - m_1^2).\) It follows that \[\begin{aligned} Var[S] &= E[ Var[S | N] ] + Var[ E[S | N] ] \\ &= E[ N (m_2 - m_1^2) ] + Var[ N m_1 ] \\ &= E[ N ] (m_2 - m_1^2) + Var[ N ] m_1 ^2. \end{aligned}\]
Example 4.3 Show that \(M_S(t) = M_N(\log(M_X(t)))\).
Solution:
First, consider the following conditional expectation: \[\begin{aligned} E\left [e^{t S} | N = n \right] &= E\left[e^{t (X_1 + X_2 + \cdots X_n)}\right] \\ &= E\left[e^{t X_1}\right] \cdot E\left[e^{t X_2}\right] \cdots E\left[e^{t X_n}\right] \text{, since } X_1, X_2 \ldots, X_n \text{ are independent} \\ &= (M_X(t))^n.\end{aligned}\] Hence \(E \left [e^{t S} | N \right] = (M_X(t))^N.\)
From the definition of the moment generating function, \[\begin{aligned} M_S(t) &= E[e^{t S}] \\ &= E \left[ E[e^{t S} | N] \right ] \\ &= E \left[ (M_X(t))^N \right ]\\ &= E \left[ Exp( N \cdot \log (M_X(t) ) \right] \\ &= M_N(\log(M_X(t))) (\text{ since } M_X(t) = E[e^{tX}] ).\end{aligned}\]
4.3 Special compound distributions
4.3.1 Compound Poisson distributions
Let \(N\) be a Poisson distribution with the parameter \(\lambda\), i.e. \(N \sim Poisson(\lambda)\) and \(\{X_i \}_{i=1}^\infty\) are independent and identically distributed with distribution function \(F_X\). Then \(S = X_1 + \ldots + X_N\) is said to have a compound Poisson distribution and denote by \(\mathcal{CP}(\lambda,F_X)\).
Note The same terminology can be defined similarly for other distributions, for e.g. if \(N\) has a negative binomial distribution, then \(S\) is said to have a compound negative binomial distribution.
Example 4.4 Let \(S \sim \mathcal{CP}(\lambda,F_X)\). Show that
\(E[S] = \lambda m_1\),
\(Var[S] = \lambda m_2\),
\(M_S(t) = Exp{(\lambda(M_X(t) - 1))}.\)
The third central moment \(E[(S- E[S])^3] = \lambda m_3\), and hence \[Sk[S] = \frac{\lambda m_3}{(\lambda m_2)^{3/2}},\]
where \(m_k\) be the \(k\)th moment of \(X_1\)
Solution: 1. \(E[S] = E[N] \cdot E[X] = \lambda m_1\),
\(Var[S] = E[ N ] (m_2 - m_1^2) + Var[ N ] m_1 ^2 = \lambda(m_2 - m_1^2) + \lambda m_1^2 = \lambda m_2\),
From \[\begin{aligned} M_S(t) &= M_N(\log(M_X(t))) \\ &= Exp\left( \lambda \left( e^{\log(M_X(t))} - 1 \right) \right), \text{ since } M_N(t) = Exp(\lambda(e^t - 1)) \\ &= Exp{(\lambda(M_X(t) - 1))}. \end{aligned}\]
The third central moment \(E[(S- E[S])^3] = \lambda m_3\), and hence \[Sk[S] = \frac{\lambda m_3}{(\lambda m_2)^{3/2}}.\] In particular, we have \[\begin{aligned} E[(N- E[N])^3] &= E\left [ N^3 - 3 N^2 \cdot E[N] + 3 N \cdot (E[N])^2 - (E[N])^3 \right] \\ &= E[N^3] - 3 E[N^2] \cdot E[N] + 2 (E[N])^3 \\ &= M_N'''(0) - 3 M_N''(0) \cdot M_N'(0) + 2 (M_N'(0))^3\end{aligned}\]
For \(N \sim Poisson(\lambda)\), \(M_N(t) = Exp(\lambda(e^t - 1)).\) By differentiating \(M_N(t)\) and evaluating at \(t = 0\), we can show that \[M'(0) = \lambda, \quad M''(0) = \lambda (1 + \lambda), \quad M'''(0) = \lambda (1 + 3\lambda + \lambda^2).\] Hence, \(E[(N- E[N])^3] = \lambda.\)
Similarly,
\[\begin{aligned} E[(S- E[S])^3] &= E[S^3] - 3 E[S^2] \cdot E[S] + 2 (E[S])^3 \\ \end{aligned}\] In addition, \(M_S(t) = Exp{(\lambda(M_X(t) - 1))}.\) By differentiating \(M_S(t)\) we can show that \[\begin{aligned} M'''_S(t) &= \lambda M'''_X(t) M_S(t) + 2 \lambda M''_X(t) M'_S(t) + \lambda M'_X(t) M''_S(t).\\ \end{aligned}\] Evaluating \(M'''_S(t)\) at \(t = 0\) results in \[\begin{aligned} M'''_S(0) &= E[S^3] = \lambda m_3 + 3 E[S] \cdot E[S^2] - 2( E[S])^3,\end{aligned}\] which gives \[\begin{aligned} E[(S- E[S])^3] &= E[S^3] - 3 E[S^2] \cdot E[S] + 2 (E[S])^3 \\ &= \lambda m_3.\end{aligned}\]
Example 4.5 Let \(S\) be the aggregate annual claims for a risk where \(S \sim \mathcal{CP}(10,F_X)\) and the individual claim amounts have a \(Pa(4,1)\) distribution. Calculate \(E[S], Var[S]\) and \(Sk[S]\).
Solution:
Since \(X \sim Pa(4,1)\) with \(\alpha = 4\) and \(\lambda = 1\), we
have \[\begin{aligned}
E[X^r] &= \frac{\Gamma(\alpha - r) \cdot \Gamma(1 + r) \cdot \lambda^r }{\Gamma(\alpha)}\\
E[X] &= \frac{\lambda}{\alpha - 1} = \frac{1}{4-1} = \frac{1}{3}\\
E[X^2] &= \frac{\Gamma(2) \cdot \Gamma(3) \cdot \lambda^2 }{\Gamma(4)} = \frac{1}{3}\\
E[X^3] &= \frac{\Gamma(1) \cdot \Gamma(4) \cdot \lambda^3 }{\Gamma(4)} = 1.\\ \end{aligned}\]
We have \[\begin{aligned}
E[S] &= \lambda E[X] = \frac{10}{3} \\
Var[S] &= \lambda E[X^2] = \frac{10}{3} \\
Sk[S] &= \frac{\lambda E[X^3]}{\left(\lambda E[X^2]\right)^{3/2}} = \frac{10}{(10/3)^{3/2}} = 1.6432.\\ \end{aligned}\]
In what follows, we will use R to simulate \(n\) observations from a compound Poisson distribution, where the Poisson parameter is \(\lambda\) and where the claims are exponentially distributed with mean \(\mu\), i.e. \(CP(\lambda, Exp(1/\mu))\)
# Simulation n observations from a CP(lambda,FX) distribution
# Assumptions:
# N ~ Poisson(lambad)
# X ~ Pa(alpha,beta)
library(actuar)
<- 10000
n <- 10
lambda <- 4
alpha <- 1
beta
<- rep(0,n)
totalClaims <- rpois(n,lambda)
numclaims for (i in 1:n)
<- sum(rpareto(numclaims[i], shape =alpha, scale = beta))
totalClaims[i] hist(totalClaims)
mean(totalClaims)
## [1] 3.338976
var(totalClaims)
## [1] 3.29011
library(moments)
skewness(totalClaims)
## [1] 1.345385
Note An important property of independent, but not necessarily identically distributed, compound Poisson random variables is that the sum of a fixed number of them is also a compound Poisson random variable.
Example 4.6 Let \(S_1, \ldots, S_n\) be independent compound Poisson random variables, with parameters \(\lambda_i\) and \(F_i\). Then \(S = \sum_{i=1}^n S_i\) has a compound distribution with parameter \[\lambda = \sum_{i=1}^n \lambda_i,\] and \[F = \frac{1}{\lambda}\sum_{i=1}^n \lambda_i F_i.\]
Solution: Exercise.
Note The compound Poisson distribution is the most often used in practice. It possesses the additivity of independent compound Poisson distributions (as shown in Example 4.6, and the expressions of the first three moments are very simple.
4.3.2 Compound negative binomial distributions
A useful discrete random variable that can be used for modelling the distributions of claim numbers is a negative binomial distribution. A random variable \(N\) has a negative distribution with parameters \(k\) and \(p\), denoted by \(N \sim NB(k,p)\) if its probability mass function is given by \[f_N(n) = \Pr(N = n) = \frac{\Gamma(k+n)}{\Gamma(n+1)\Gamma(k)} p^k (1- p)^n \quad n = 0,1,2,\ldots.\] It can be interpreted as the probability of getting \(n\) failures before the \(k\)th success occurs in a sequence of independent Bernoulli trials with probability of success \(p\).
Example 4.7 Let \(N \sim NB(k,p)\). Show that the mean, variance and moment generating function of the compound negative binomial distribution, denoted by \(\mathcal{CNB}(k,p,F_X)\), are as follows:
\(E[S] = \frac{k q}{p} m_1\),
\(Var[S] = \frac{k q}{p^2} (p m_2 + q m_1^2)\),
\(M_S(t) = \left( \frac{ p }{ 1 - q M_X(t) } \right)^k,\)
where \(m_k\) be the \(k\)th moment of \(X_1\) and \(q = 1-p\).
Solution: The results follows from the properties of the negative binomial distribution \(N \sim NB(k,p)\): \[E[N] = \frac{kq}{p}, \quad Var[N] = \frac{kq}{p^2},\] and the moments of a compound distribution \(S\) derived in Section 4.2.
Notes 1. The negative binomial distribution is an alternative to the Poisson distribution for \(N\), in the sense that it allows for any value of \(N = 0, 1, 2, \ldots\), unlike the binomial distribution which has an upper limit.
One advantage that the negative binomial distribution has over the Poisson distribution is that its variance exceeds its mean. These two quantities are equal for the Poisson distribution.
Thus, the negative binomial distribution may give a better fit to a data set which has a sample variance in excess of the sample mean.
- The compound negative binomial distribution is an appropriate to model the heterogeneity of the numbers of claims occurring for different risks. In particular, suppose that for each policy, the number of claims in a year has a Poisson distribution \(N | \lambda \sim Poisson(\lambda)\), and that the variation in \(\lambda\) across the portfolio can be modelled using a Gamma distribution \(\mathcal{G}(\alpha, \lambda)\). Then the number of claims in the year for a policy chosen at random from the portfolio has a negative binomial distribution.
<IP_ADDRESS> Misture distributions
Suppose we model a policyholder’s claim number \(N\) using a conditional distribution \(N | \lambda\), where \(\lambda\) can be thought of as a “risk parameter” for that policyholder.
Policyholders represent a variety of risks and have different risk parameters, and we model the variation across policyholders by regarding the various \(\lambda\)s as being independent realisations of a random variable with known probability distribution. This gives the joint density, which we can write as \(f_{N,\lambda}(k, \lambda) = f_\lambda(\lambda) f_{N|\lambda}(k | \lambda)\).
This enables us to allow for variability in the risks across a portfolio; that is, to model the heterogeneity of the numbers of claims occurring for different risks.
Example 4.8 A portfolio consists of a large number of individual policies. For each policy, the number of claims in a year has a poisson distribution \(N | \lambda \sim Poisson(\lambda)\). Let us suppose that the variation in \(\lambda\) across the portfolio of risks can be modelled using a gamma \(\mathcal{G}(\alpha,\beta)\) distribution with known parameters, and let us use this to average across the risks.
We are considering a mixture of Poissons where the mixing distribution if gamma. This is also known as a mixture distribution. Derive the probability mass function of the mixture distribution.
Solution:
For \(k = 0,1,2,\ldots\), we have
\[ \begin{aligned} \Pr(N = k) &= \int f_\lambda(\lambda) \Pr(N = k | \lambda) \, d\lambda \\ &= \int_{0}^\infty \frac{\beta^\alpha}{\Gamma(\alpha)} \lambda^{\alpha -1} e^{\beta \lambda} e^{-\lambda} \frac{\lambda^k}{k!} \, d\lambda \\ &= \frac{\Gamma(\alpha + k)}{\Gamma(\alpha) \Gamma(1 + k)} \frac{\beta^\alpha}{(\beta+1)^{\alpha+k}} \times \int_0^\infty h(\lambda) \, d\lambda \end{aligned} \] where \(h(\lambda)\) is the probability density function of \(\lambda \sim \mathcal{G}(\alpha + k, \beta + 1)\).
Hence,
\[ \Pr(N =k) = \frac{\Gamma(\alpha + k)}{\Gamma(\alpha) \Gamma(1 + k)} \left(\frac{\beta}{\beta+1}\right)^\alpha \left(\frac{1}{\beta+1}\right)^k, k = 0,1,2,\ldots,\]
which is the probability mass function of a \(\mathcal{NB}(\alpha, \beta/(\beta + 1))\) distribution.
This provides an illuminating view of the negative binomial distribution – it arises as a mixture of Poissons where the mixing distribution is gamma.
<IP_ADDRESS> an Example in R
This R Markdown introduces the concept of mixture distributions which applies to models for claim numbers.
Suppose we model a policyholder’s claim numbers \(N\) using a conditional distribution \(N | \lambda\), where \(\lambda\) can be thought of as a risk parameter for that policyholder. Policyholders represent a variety of risks and have different risk parameters, and we model the variation across policyholders by regarding the various \(\lambda\)s as being independent realisations of a random variable with known probability distribution.
The following R code produces the required \(n\) simulated values from this mixture distribution, where \(N | \lambda \sim Poisson(\lambda)\) with mixing distribution \(\mathcal{G}(\alpha, \beta)\), i.e. \(\lambda \sim \mathcal{G}(\alpha, \beta)\).
4.3.3 Compound binomial distributions
A compound binomial distribution can be used to model a portfolio of policies, each of which can give rise to at most one claim.
Example 4.9 Consider a portfolio of \(n\) independent and identical policies where there is at most one claim on each policy in a year (for e.g. life insurance). Let \(p\) be the probability that a claim occurs. Explain that the aggregate sum \(S\) in this portfolio has a compound binomial distribution, denoted by \(\mathcal{CB}(n,p,F_X)\). Derive the mean, variance and moment generating function of \(S\).
Solution: Since \(n\) policies (lives) are independent with the probability \(p\) that a claim occurs, the number \(N\) of claims on the portfolio in one year has a binomial distribution i.e. \(N \sim \text{bi}(n,p)\). If the sizes of the claims are i.i.d. random variables, independent of \(N\), then the total amount \(S\) claimed on this policy in one year has a compound binomial distribution.
The mean, variance and the moment generating function of \(S\) are as follows: \[\begin{aligned} E[S] &= n p m_1, \\ Var[S] &= np m_2 - n p^2 m_1^2, \\ M_S(t) &= \left( q + p M_X(t) \right)^n,\end{aligned}\] where \(m_k\) be the \(k\)th moment of \(X_1\) and \(q = 1-p\).
4.4 The effect of reinsurance
The effect of reinsurance arrangements on an aggregate claims distribution will be presented. Let \(S\) denotes the total aggregate claims from a risk in a given time, \(S_I\) and \(S_R\) denote the insurance and reinsurance aggregate claims, respectively. It follows that \[S = S_I + S_R.\]
4.4.1 Proportional reinsurance
Recall that under proportional reinsurance arrangement, a fixed proportion \(\alpha\) is paid by the direct insurer and the remainder of the claim is paid by the reinsurer. It follows that \[S_I = \sum_{i= 1}^N \alpha X_i = \alpha S\] and \[S_R = \sum_{i= 1}^N (1- \alpha) X_i = (1- \alpha) S,\] where \(X_i\) is the amount of the \(i\)th claim.
Notes
Both direct insurer and the reinsurer are involved in paying each claim.
Both have unlimited liability unless a cap on the claim amount is arranged.
Example 4.10 Aggregate claims from a risk in a given time have a compound Poisson distribution with Poisson parameter \(\lambda = 10\) and an individual claim amount distribution that is a Pareto distribution, \(Pa(4,1)\). The insurer has effected proportional reinsurance with proportion retained \(\alpha = 0.8\).
Find the distribution of \(S_I\) and \(S_R\) and their means and variances.
Compare the variances \(Var[S_I] +Var[S_R]\) and \(Var[S]\). Comment on the results obtained.
Solution: 1. We have \[\begin{aligned} S_I &= \sum_{i=1}^N \left( \alpha X_i \right) = \alpha \sum_{i=1}^N X_i = \alpha \cdot S, \\ S_R &= \sum_{i=1}^N \left( (1- \alpha) X_i \right) = (1- \alpha) \sum_{i=1}^N X_i = (1- \alpha) \cdot S,\end{aligned}\] since both insurer and reinsurer are involved in paying each claim, i.e. \(Y_i = \alpha X_i\) and \(Z_i = (1- \alpha) X_i\). It follows that \(S_I \sim \mathcal{CP}(10,F_Y)\) and \(S_R \sim \mathcal{CP}(10,F_Z)\).
As we can show that if \(X \sim Pa(\beta,\lambda)\), then \(W = k X \sim Pa(\beta,k \lambda)\). For \(X \sim Pa(4,1)\) with \(\beta = 4\) and \(\lambda = 1\), we have \(Y_i \sim Pa(\beta, \alpha \cdot \lambda) = Pa(4, 0.8)\) and \[\begin{aligned} E[S_I] &= 10 \cdot E[Y_i] = 10 \cdot \frac{\alpha \cdot \lambda}{\beta - 1} \\ & = \frac{8}{3}, \\ Var[S_I] &=10 \cdot E[Y_i^2] = 10 \cdot \frac{\Gamma(\beta - 2) \cdot \Gamma(1 + 2) \cdot (\alpha \cdot \lambda)^2 }{\Gamma(\beta)} \\ &= 10 \cdot \frac{\Gamma(2) \cdot \Gamma(3) \cdot (\alpha \cdot \lambda)^2 }{\Gamma(4)} = 10 \cdot \frac{2!}{3!} \cdot (0.8)^2 \\ &= \frac{32}{15} \end{aligned}\]
Alternatively, we can calculate by using the properties of the expectation and variance as follows: \[\begin{aligned} E[S_I] &= E[\alpha S] = \alpha\cdot E[S] = \alpha\cdot \lambda \cdot E[X] = 10 \cdot 0.8 \cdot \frac{1}{3} = \frac{8}{3}, \\ Var[S_I] &= Var[\alpha S] = \alpha^2 \cdot Var[S] \\ &= \alpha^2 \cdot \lambda \cdot E[X^2] = \frac{32}{15} .\end{aligned}\]
Similarly, \[\begin{aligned} E[S_R] &= E[(1 - \alpha) S] = (1 - \alpha)\cdot E[S] = \frac{2}{3}, \\ Var[S_R] &= Var[(1 - \alpha) S] = (1 - \alpha)^2 \cdot Var[S] = \frac{2}{15} .\end{aligned}\] Note that \(E[S_I] + E[S_R] = E[S]\), while \(Var[S_I] + Var[S_R] = \frac{34}{15} < Var[S] = \frac{10}{3}.\)
4.4.2 Excess of loss reinsurance
Recall that under excess of loss reinsurance arrangement, the direct insurer has effected excess of loss reinsurance with retention level \(M >0\). For a claim \(X\),
the insurance company pays any claim in full if \(X \le M\); and
the reinsurer (or reinsurance company) pays the remaining amount of \(X - M\) if \(X > M\).
It follows that
\[\begin{equation} \tag{4.2} S_I = \sum_{i= 1}^N Y_1 + Y_2 + \ldots + Y_N = \sum_{i= 1}^N \min(X_i,M) \end{equation}\] and \[\begin{equation} \tag{4.3} S_R = \sum_{i= 1}^N Z_1 + Z_2 + \ldots + Z_N = \sum_{i= 1}^N \max(0,X_i - M), \end{equation}\] where \(X_i\) is the amount of the \(i\)th claim. When \(N = 0\), we set \(S_I = 0\) and \(S_R = 0\).
Note \(S_R\) can equal 0 even if \(N > 0\). This occurs when all claims do not exceed \(M\) and hence the insurer pays the full amounts of claims.
As discussed in the previous section, the reinsurer is involved only claims which exceed the retention limit (a claim such that \(X > M\)). Such claims are called reinsurance claims. Taking in account of counting only non-zero claims, we can rewrite \(S_R\) as follows. Let \(N_R\) be the number of insurance (non-zero) claims for the reinsurer and \(W_i\) be the amount of the \(i\)th non-zero payment by the reinsurer. The aggregate claim amount paid by the reinsurer can be written as \[S_R = \sum_{i= 1}^{N_R} W_i.\]
Example 4.11 By using the probability generating function, show that if \(N \sim Poisson(\lambda)\), then the distribution \(N_R \sim Poisson(\lambda \pi_M)\) where \(\pi_M = \Pr(X_j > M)\).
Solution: Define the indicator random variable \(\{I_j\}_{j=1}^\infty\), where \[\begin{aligned} I_j = \begin{cases} 1 &\text{if } X_j > M\\ 0 &\text{if } X_j \le M. \end{cases}\end{aligned}\] Therefore, \[N_R = \sum_{j= 1}^{N} I_j.\] The variable \(N_R\) has a compound distribution with its probability generating function \[P_{N_R}(r) = P_N[P_I(r)],\] where \(P_I\) is the probability generating function of the indicator random variable. It can be shown that \[P_I(r) = 1 - \pi_M + \pi_M r,\] where \(\pi_M = \Pr(I_j = 1) = \Pr(X_j > M) = 1 - F(M)\).
Note In the above example, one can derive the distribution of \(N_R\) by using the moment generating function: \[M_{N_R}(t) = M_N(\log M_I(t)),\] where \(M_N\) and \(M_I\) are the moment generating functions of \(N\) and \(I\). Note also that \[M_I(t) = 1 - \pi_M + \pi_M Exp(t).\]
4.4.3 Compound Poisson distributions under excess of loss reinsurance
Assume that aggregate claim amount \(S \sim \mathcal{CP}(\lambda,F_X)\) has a compound Poisson distribution. Under excess of loss reinsurance with retention level \(M\), it follows from (4.2) and (4.3) that
\(S_I \sim \mathcal{CP}(\lambda,F_Y),\)
where \(f_Y(x) = f_X(x)\) for \(0 < x < M\) and \(\Pr(Y = M) = 1 - F_X(M)\).
\(S_R \sim \mathcal{CP}(\lambda,F_Z),\)
where \(F_Z(0) = F_X(M)\) and \(f_Z(x) = f_X(x+M), x > 0\).
Excluding zero claims, \(S_R \sim \mathcal{CP}(\lambda \,( 1 - F_X(M)) , F_W),\)
where \(f_W(x) = \displaystyle{\frac{f_X(x+M)}{1- F_X(M)}}, x > 0\).
Example 4.12 Suppose that \(S\) has a compound Poisson distribution with Poisson parameters \(\lambda = 10\) and the claim sizes have the following distribution
| \(x\) | 1 | 2 | 5 | 10 |
|---|---|---|---|---|
| \(\Pr(X = x)\) | 0.4 | 0.3 | 0.2 | 0.1 |
The insurer enters into an excess of loss reinsurance contract with retention level \(M = 4\).
Show that \(S_I \sim\mathcal{CP}(\lambda,F_Y)\).
Show that \(S_R \sim\mathcal{CP}(\lambda,F_Z)\).
By excluding zero claims, show that the \(S_R\) can also be expressed as \(S_R \sim \mathcal{CP}(\lambda \, p,F_W)\) where \(p = \Pr(X > M)\).
Find the mean and variance of the aggregate claim amount for both insurer and reinsurer.
Solution:
- Recall that \(S_I = \sum_{i=1}^N \min\{X_i,4\}.\) The number of claim remains the same, and hence \(N \sim Poisson(10)\). The distribution of claim amount paid by the insurer, \(F_Y(x)\) is given by
| \(x\) | 1 | 2 | 4 |
|---|---|---|---|
| \(\Pr(Y = x)\) | 0.4 | 0.3 | 0.3 |
Therefore, \(S_I \sim \mathcal{CP}(10,F_Y)\) and
\[\begin{aligned} \mathrm{E}[S_I] &= 10 E[Y] = 10(1(0.4) + 2(0.3) + 4(0.3)) = 22, \\ \mathrm{Var}[S_I] &= 10 E[Y] = 10(1^2(0.4) + 2^2(0.3) + 4^2(0.3)) = 64. \end{aligned}\]
- We have \(S_R = \sum_{i=1}^N \max\{0, X_i - 4\}.\) When zero claims are included, \(N_R = N \sim Poisson(10)\). The distribution of claim amount paid by the reinsurer, \(F_Z(x)\) is given by
| \(x\) | 0 | 1 | 6 |
|---|---|---|---|
| \(\Pr(Z = x)\) | 0.7 | 0.2 | 0.1 |
Therefore, \(S_R \sim \mathcal{CP}(10,F_Z)\) and
\[\begin{aligned} \mathrm{E}[S_R] &= 10 E[Z] = 0, \\ \mathrm{Var}[S_R] &= 10 E[Z^2] = 38. \end{aligned}\]
Notes
\(\mathrm{E}[S] = 10 \mathrm{E}[X] = 30\) and \(\mathrm{Var}[S]= 10 \mathrm{E}[X^2] = 166.\)
\(\mathrm{E}[S_I + S_R] = \mathrm{E}[S]\), and \[\mathrm{Var}[S_I + S_R] = 64 + 38 < 166 = \mathrm{Var}[S].\]
- Consider the reinsurer’s position when zero claims are excluded. We define \[ W = Z | Z >0 = X - 4 | X > 4.\] We first compute \(\pi_M\), the proportion of claims which involve the reinsurer, from \[ \pi_M = \mathrm{Pr}(X>4) = \mathrm{Pr}(X = 5) + \mathrm{Pr}(X = 10) = 0.3.\] Recall that \(S_R = \sum_{i=1}^{N_R} W_i.\) We have \(S_R \sim \mathcal{CP}(0.3 \times 10, F_W)\) and the distribution of \(W, F_W(x)\) is given by
\[ \begin{aligned} \mathrm{Pr}(W = 1) &= \mathrm{Pr}(X = 5 | X > 4) = \frac{ \mathrm{Pr}(X = 5 , X > 4) }{\mathrm{Pr}(X > 4)} = \frac{ \mathrm{Pr}(X = 5) }{\mathrm{Pr}(X > 4)} = \frac{2}{3} \\ \mathrm{Pr}(W = 6) &= 1- \mathrm{Pr}(W = 1) = \frac{1}{3}. \end{aligned} \] Hence, \[ \begin{aligned} \mathrm{E}[S_R] &= (10 \times 0.3)(1(2/3) + 6(1/3)) = 8, \\ \mathrm{Var}[S_R] &= (10 \times 0.3)(1^2(2/3) + 6^2(1/3)) = 38. \end{aligned} \]
Example 4.13 Suppose that \(S\) has a compound Poisson distribution with Poisson parameters \(\lambda = 40\) and the claim sizes have a Pareto distribution \(Pa(3,4)\). The insurer has an excess of loss reinsurance contract in place with retention level \(M = 2\). Find the mean and variance of the aggregate claim amount for both insurer and reinsurer.
Solution: 1. Zero claims included. Recall that that for \(X \sim \mathcal{Pa}(\alpha,\lambda)\), its density function is \[ f_X(x) = \frac{\alpha \lambda^\alpha}{ (x + \lambda)^{\alpha + 1}}.\] We know that \(S_R \sim \mathcal{CP}(40,F_Z)\). Moreover,
\[ \begin{aligned} \mathrm{E}[Z] &= 0 F_Z(0) + \int_0^\infty x f_Z(x)\, dx \\ &= \int_0^\infty x f_X(x + M)\, dx \\ &= \int_0^\infty \frac{x \cdot 3 \cdot 4^3}{(x + 2 + 4)^{3+1}} \, dx\\ &= \frac{4^3}{6^3} \int_0^\infty \frac{x \cdot 3 \cdot 6^3}{(x + 6)^{3+1}} \, dx \\ &= \frac{4^3}{6^3} \frac{6}{3-1} = 0.88\ldots .\\ \end{aligned} \] Note that the last integral above is the mean of \(\mathcal{Pa}(3,6)\), which is equal to \(6/(3-1)\).
For \(\mathrm{E}[Z^2]\), we proceed as follows: \[ \begin{aligned} \mathrm{E}[Z^2] &= 0^2 F_Z(0) + \int_0^\infty x^2 f_Z(x)\, dx \\ &= \int_0^\infty x^2 f_X(x + M)\, dx \\ &= \int_0^\infty \frac{x^2 \cdot 3 \cdot 4^3}{(x + 2 + 4)^{3+1}} \, dx\\ &= \frac{4^3}{6^3} \int_0^\infty \frac{x^2 \cdot 3 \cdot 6^3}{(x + 6)^{3+1}} \, dx \\ &= \frac{4^3}{6^3} 6^2 = 10.66\ldots .\\ \end{aligned} \] Note that the last integral above is the second moment about the origin of \(\mathcal{Pa}(3,6)\), which is equal to \([6^2 \cdot\Gamma(3-2)\Gamma(1+2)] /\Gamma(3) = 6^2\).
Therefore, \[\begin{aligned} \mathrm{E}[S_R] &= \lambda E[Z] = 320/9, \\ \mathrm{Var}[S_R] &= \lambda E[Z^2] = 1280/3. \end{aligned}\]
- Zero claims excluded We define \[ W = Z | Z >0 = X - M | X > M.\]
\[ \begin{aligned} \mathrm{E}[W] &= \int_0^\infty x f_W(x)\, dx \\ &= \int_0^\infty \frac{x f_X(x + 2)}{(1 - F_X(2))} \, dx \\ &= \frac{1}{(1 - F_X(2))} \int_0^\infty x f_X(x + 2) \, dx \\ &= \frac{1}{(1 - F_X(2))}\cdot \mathrm{E}[Z]. \end{aligned} \] It follows that \[ \mathrm{E}[S_R] = \lambda\cdot \mathrm{Pr}(X > M) \cdot \mathrm{E}[W] = 40 ( 1 - F_X(2)) \mathrm{E}[W] = 40\mathrm{E}[Z] = 320/9.\] Similarly, one can show that \[ \begin{aligned} \mathrm{E}[W^2] &= \int_0^\infty x^2 f_W(x)\, dx \\ &= \frac{1}{(1 - F_X(2))}\cdot \mathrm{E}[Z^2]. \end{aligned} \] This results in \[\mathrm{Var}[S_R] = \lambda \cdot \mathrm{Pr}(X > M) \cdot \mathrm{E}[W^2] = 40 ( 1 - F_X(2)) \mathrm{E}[W^2] = 40\mathrm{E}[Z^2] = 1280/3.\]
- Note that \(S = S_I + S_R\) and
\[ \mathrm{E}[S] = \lambda \mathrm{E}[X] = 40 \frac{4}{3-1} = 80. \]
Therefore,
\[ \mathrm{E}[S_I] = 80 - \frac{320}{9} = \frac{400}{9}. \]
4.5 Approximation of the collective risk model
4.5.1 The normal approximation
According to the Central Limit Theorem, if the mean number of claims is large, then the distribution of aggregate claims \(S\) can be approximated by a normal distribution, i.e. \(S \sim \mathcal{N}(\mathrm{E}[S], \mathrm{Var}[S])\).
Notes
The normal approximation may not provide a good approximation to the distribution of \(S\) because the true distribution of \(S\) is skew. However, the normal approximation is symmetric.
The normal approximation is likely to underestimate tail probabilities which are the most interest quantities of insurers.
Example 4.14 Aggregate claims from a risk in a given time have a compound Poisson distribution with Poisson parameter \(\lambda\) and an individual claim amount distribution that is a lognormal distribution with mean 1 and variance 2.5.
Approximate the distribution of \(S\) using the normal distribution when (a) \(\lambda = 10\) and (b) \(\lambda = 100\).
Find \(x\) such that \(\Pr(S \le x) = 0.95\) in both cases.
Comment on the obtained results.
4.5.2 The translated gamma approximation
The translated gamma approximation makes use of the first three moments of \(S\) and provides an improvement of the approximation over the normal approximation. We assume that \(S\) can be approximated by \(Y + k\) where \(Y \sim \mathcal{G}(\alpha, \lambda)\) and \(k\) is a constant. This distribution \(Y + k\) is said to have a translated gamma distribution. By matching the moments of the two distribution, the parameters \(\alpha, \lambda\) and \(k\) can be found from \[\begin{aligned} Sk[S] &= \frac{2}{\sqrt{\alpha}}, \\ Var[S] &= \frac{\alpha}{\lambda^2},\\ E[S] &= \frac{\alpha}{\lambda} + k.\end{aligned}\]
Example 4.15 Show that the parameters \(\alpha, \lambda\) and \(k\) satisfy \[\begin{aligned} \alpha &= \frac{4}{Sk[S]^2}, \\ \lambda &= \sqrt{\frac{\alpha}{Var[S]}} \\ k &= E[S] - \frac{\alpha}{\lambda}.\end{aligned}\]
Example 4.16 The aggregate claims \(S\) have the compound Poisson distribution as given in Example 4.14.
Use the translated gamma approximation to find \(x\) such that \(\Pr(S \le x) = 0.95\) when (a) \(\lambda = 10\) and (b) \(\lambda = 100\).
Comment on the obtained results.
4.6 Recursive calculation of the collective risk model
The Panjer recursion formula provides recursive calculation of the collective risk model. The algorithm can be numerically computed on a computer provided that distribution of claim numbers \(N\) satisfy Panjer’s recursion formula, \[p_n = \left( a + \frac{b}{n} \right) p_{n-1}, \quad n = 1,2, \ldots,\] where \(a\) and \(b\) are constants.
Example 4.17 Show that a Poisson distribution \(N \sim Poisson(\lambda)\) satisfies Panjer’s recursion formula, i.e. find the constants \(a\) and \(b\).
Assume that the claim size variable \(X\) takes only positive integers and the distribution of claim numbers satisfies the Panjer’s recursion formula. We define
\(f_k = \Pr(X = k), \quad k = 1,2, \ldots,\)
\(g_r = \Pr(S = r), \quad r = 0,1,2, \ldots.\)
Then the unknown \(g_r\) can be recursively calculated by
\(g_0 = p_0\),
\(g_r = \sum_{j=1}^r \left( a + \frac{bj}{r} \right) f_j g_{r-j}, \quad r = 1,2 \ldots.\)
Note If \(X\) is not a discrete random variable, then we first approximate it by a discrete distribution and then apply the Panjer’s recursion algorithm.
Example 4.18 Aggregate claims \(S\) have a compound Poisson distribution \(\mathcal{CP}(\lambda,F_X)\) where \(\lambda = 1\) and an individual claim amount \(X\) is either 1 or 2 with probability 3/4 and 1/4, respectively. Calculate \(g_r\) for \(r = 0,1,2,3,4,5\).


| gbd_dmat {pbdDEMO} | R Documentation |
This function convert a GBD matrix and a distributed dense matrix.
gbd2dmat(X.gbd, skip.balance = FALSE, comm = .pbd_env$SPMD.CT$comm, gbd.major = .pbd_env$gbd.major, bldim = .pbd_env$BLDIM, ICTXT = .pbd_env$ICTXT) dmat2gbd(X.dmat, bal.info = NULL, comm = .pbd_env$SPMD.CT$comm, gbd.major = .pbd_env$gbd.major)
X.gbd |
a GBD matrix. |
skip.balance |
if |
comm |
a communicator number. |
gbd.major |
1 for row-major storage, 2 for column-major. |
bldim |
the blocking dimension for block-cyclically distributing the matrix across the process grid. |
ICTXT |
BLACS context number for return. |
X.dmat |
a ddmatrix matrix. |
bal.info |
a returned object from |
X.gbd
is a matrix with dimension N.gbd * p
and exists on all
processors. N.gbd
may be vary across processors.
If skip.balance = TRUE
, then load.balance
will not be called
and X.gbd
is preassumed to be balanced.
For demonstration purpose, these objects should not contains weird values
such as NA
.
dmat2gbd
is supposed returned a balanced gbd matrix if
bal.info
is not supplied.
gbd2dmat
returns a ddmatrix object. dmat2gbd
returns
a (balanced) gbd matrix.
## Not run: ### Under command mode, run the demo with 4 processors by ### (Use Rscript.exe for windows system) mpiexec -np 4 Rscript -e "demo(gbd_dmat,'pbdDEMO',ask=F,echo=F)" ## End(Not run)


{% extends "joinJob.html" %} {% load static %} {% block head_title %}{{ block.super }} :: Join us :: Postdoc in bacterial whole-cell modeling{% endblock %} {% block page_title %}Postdoctoral Fellow or Senior Scientist in bacterial whole-cell modeling{% endblock %} {% block page_pdf %}{% endblock %} {% block job_details %}
The scientist will be responsible for developing a whole-cell model of Mycoplasma pneumoniae and using the model to design Mycoplasmas for bacterial-based drug delivery. This will include expanding the scope of our existing whole-cell models, incorporating new sources of high-throughput genomic data, and improving the accuracy of whole-cell models. The scientist will work closely with software developers to design a software platform for whole-cell modeling. The scientist will also collaborate with Luis Serrano's laboratory at the Center for Regulatory Genomics in Barcelona, Spain.
The ideal candidate has the following skills. Applicants with deep experience in related fields are also encouraged to apply.


CNU | GRADES
home
Home
lightbulb_outline
Subjects
import_contacts
Classes
account_circle
My Students
create
Templates
power_settings_new
Logout
Grade Record | Mid Terms
Student Name
Student ID
Class Standing (60%)
date_range
Task #1
chrome_reader_mode
Homework #1
content_copy
Output #1
camera_roll
Performance #1
Major Exam (40%)
Exam Score
save
Save Record


In the game of blackjack, the cards 2 through 10 are counted at their face values, regardless of suit; all face cards (jack, queen, and king) are counted as 10; and an ace is counted as a 1 or 11, depending on the total count of all cards in a player’s hand. The ace is counted as 11 only if the resulting total value of all cards in a player’s hand doesn’t exceed 21; otherwise, it’s counted as 1. Using this information, write a C++ program that accepts three card values as inputs (a 1 corresponding to an ace, a 2 corresponding to a two, and so on), calculates and display the total value of the hand, and the sum of the three cards.
result:


Compute the linearized expansion equation and keep track of results.
More...
|
| | _max_deltas |
| | Maximum deviations from target expansion of all evaluations. More...
|
| |
|
| _parallel |
| |
|
| _pool |
| |
Compute the linearized expansion equation and keep track of results.
◆ __init__()
| def __init__ |
( |
|
self, |
|
|
|
curve, |
|
|
|
target_expansion = 0 , |
|
|
|
accurate_test_res = None , |
|
|
|
parallel = False , |
|
|
|
pool = None |
|
) |
| |
Init function.
- Parameters
-
| curve | Curve along which the expansion/equation should be computed. |
| target_expansion | Constant expansion to aim for. Will be added to the inhomogeneity of the linear equation. Default is 0 . |
| accurate_test_res | Resolution for the more accurate convergence check. |
| parallel | Whether to evaluate the equation using multiple processes in parallel. |
| pool | Optional processing pool to re-use instead of creating a new one. |
◆ __call__()
| def __call__ |
( |
|
self, |
|
|
|
pts |
|
) |
| |
Return the equation suitable for ndsolve().
◆ accurate_abs_delta()
| def accurate_abs_delta |
( |
|
self, |
|
|
|
curve |
|
) |
| |
Compute the deviation from the target expansion more accurately.
This uses the accurate_test_res
to evaluate the expansion at a different set of points than the collocation points and returns the maximum absolute value.
◆ has_accurate_test()
| def has_accurate_test |
( |
|
self | ) |
|
Return whether we should perform accurate convergence tests between collocation points.
◆ prev_abs_delta()
| def prev_abs_delta |
( |
|
self | ) |
|
Maximum deviation from target expansion.
◆ prev_rel_delta()
| def prev_rel_delta |
( |
|
self | ) |
|
Maximum deviation from target expansion relative to first evaluation.
◆ _max_deltas
Maximum deviations from target expansion of all evaluations.
◆ accurate_test_res
Resolution for the more accurate convergence check.
Target expansion (0 for MOTSs).
◆ curve
The documentation for this class was generated from the following file:
- motsfinder/axisym/newton.py


Operating Systems
This section contains information about the different operating systems you can install on your PC.
Pages
Windows
Linux
Quiz


|
By Eric Lawrey, Copyright 1997-2001
An OFDM system was modelled using Matlab
to allow various parameters of the system to be varied and tested. The
aim of doing these simulations was to measure the performance of OFDM under
different channel conditions, and to allow for different OFDM configurations
to be tested. Four main criteria were used to assess the performance of
the OFDM system, which were its tolerance to multipath delay spread, peak
power clipping, channel noise and time synchronization errors.
2.1 OFDM Model Used
The OFDM system was modelled using Matlab
and is shown in Figure 16. A brief description of the model is provided
below.
Figure 16 OFDM Model used for simulations
2.1.1 Serial to Parallel Conversion
The input serial data stream is formatted
into the word size required for transmission, e.g. 2 bits/word for QPSK,
and shifted into a parallel format. The data is then transmitted in parallel
by assigning each data word to one carrier in the transmission.
2.1.2 Modulation of Data
The data to be transmitted on each carrier
is then differential encoded with previous symbols, then mapped into a
Phase Shift Keying (PSK) format. Since differential encoding requires an
initial phase reference an extra symbol is added at the start for this
purpose. The data on each symbol is then mapped to a phase angle based
on the modulation method. For example, for QPSK the phase angles used are
0, 90, 180, and 270 degrees. The use of phase shift keying produces a constant
amplitude signal and was chosen for its simplicity and to reduce problems
with amplitude fluctuations due to fading.
2.1.3 Inverse Fourier Transform
After the required spectrum is worked out,
an inverse fourier transform is used to find the corresponding time waveform.
The guard period is then added to the start of each symbol.
2.1.4 Guard Period
The guard period used was made up of two
sections. Half of the guard period time is a zero amplitude transmission.
The other half of the guard period is a cyclic extension of the symbol
to be transmitted. (As discussed in section 1.3.10). This was to allow
for symbol timing to be easily recovered by envelope detection. However
it was found that it was not required in any of the simulations as the
timing could be accurately determined position of the samples.
After the guard has been added, the symbols
are then converted back to a serial time waveform. This is then the base
band signal for the OFDM transmission.
2.1.5 Channel
A channel model is then applied to the
transmitted signal. The model allows for the signal to noise ratio, multipath,
and peak power clipping to be controlled. The signal to noise ratio is
set by adding a known amount of white noise to the transmitted signal.
Multipath delay spread then added by simulating the delay spread using
an FIR filter. The length of the FIR filter represents the maximum delay
spread, while the coefficient amplitude represents the reflected signal
magnitude.
2.1.6 Receiver
The receiver basically does the reverse
operation to the transmitter. The guard period is removed. The FFT of each
symbol is then taken to find the original transmitted spectrum. The phase
angle of each transmission carrier is then evaluated and converted back
to the data word by demodulating the received phase. The data words are
then combined back to the same word size as the original data.
2.1.7 OFDM simulation parameters
Table 9 shows the configuration used for
most of the simulations performed on the OFDM signal. An 800-carrier system
was used, as it would allow for up to 100 users if each were allocated
8 carriers. The aim was that each user has multiple carriers so that if
several carriers are lost due to frequency selective fading that the remaining
carriers will allow the lost data to be recovered using forward error correction.
For this reason any less then 8 carriers per user would make this method
unusable. Thus 400 carriers or less was considered too small. However more
carriers were not used due to the sensitivity of OFDM to frequency stability
errors. The greater the number of carriers a system uses, the greater it
required frequency stability.
For most of the simulations the signals
generated were not scaled to any particular sample rate, thus can be considered
to be frequency normalized. Three carrier modulation methods were tested
to compare their performances. This was to show a trade off between system
capacity and system robustness. DBPSK gives 1 bits/Hz spectral efficiency
and is the most durable method, however system capacity can be increased
using DQPSK (2 bits/Hz) and D16PSK (4 bits/Hz) but at the cost of a higher
BER. The modulation method used is shown as BPSK, QPSK, and 16PSK on all
of the simulation plots, because the differential encoding was considered
to be an integral part of any OFDM transmission.
(Addendum 10/2001:
Many OFDM systems now use coherent modulation instead of differential modulation
as coherent modulation allows the use of Quadrature Amplitude Modulation
(QAM) carrier modulation, which improves the spectral efficiency).
| Parameter |
Value |
| Carrier Modulation used |
DBPSK, DQPSK, D16PSK |
| FFT size |
2048 |
| Number of carrier used |
800 |
| Guard Time |
512 samples (25%) |
| Guard Period Type |
Half zero signal, half a cyclic extension of the symbol |
Table 9 OFDM system parameters used for the simulations
(Errata Note:
10/2001. The simulation results presented here show the overall Symbol
Error Rate (SER) rather than the Bit Error Rate (BER) as indicated on the
graph results and discussions. For BPSK the SER equals the BER, however
for QPSK the BER will be approximately half the SER. This is because two
bits of information are transferred for each QPSK symbol and typically
only single bit errors occur when suitable mapping is used (gray coding)
and the noise level is low. This approximation is valid for a SER below
approximately 1x10-2. For 16PSK the same argument applies, thus the true
BER is approximately one quarter the SER).
2.2 OFDM Simulated Results
2.2.1 Multipath Delay Spread Immunity
For this simulation the OFDM signal was
tested with a multipath signal containing a single reflected echo. The
reflected signal was made 3 dB weaker then the direct signal as weaker
reflections then this did not cause measurable errors, especially for BPSK.
Figure 17 shows the simulation results.
It can be seen from Figure 17 that the
BER is very low for a delay spread of less then approximately 256 samples.
In a practical system (i.e. one with a 1.25 MHz bandwidth) this delay spread
would correspond to ~80 m sec.
This delay spread would be for a reflection with 24 km extra path length.
It is very unlikely that any reflection, which has travelled an extra 24
km, would only be attenuated by 3 dB as used in the simulation, thus these
results show extreme multipath conditions. The guard period used for the
simulations consisted of 256 samples of zero amplitude, and 256 samples
of a cyclic extension of the symbol. The results show that the tolerable
delay spread matches the time of the cyclic extension of the guard period.
It was verified that the tolerance is due to the cyclic extension not the
zeroed period with other simulations. These test however are not shown
to conserve space.
Figure 17 Delay Spread tolerance of ODFM
For a delay spread that is longer than
the effective guard period, the BER rises rapidly due to the inter-symbol
interference. The maximum BER that will occur is when the delay spread
is very long (greater then the symbol time) as this will result in strong
inter-symbol interference.
In a practical system the length of the
guard period can be chosen depending on the required multipath delay spread
immunity required.
2.2.2
Peak Power Clipping
It was found that the transmitted OFDM
signal could be heavily clipped with little effect on the received BER.
In fact, the signal could the clipped by up to 9 dB without a significant
increase in the BER. This means that the signal is highly resistant to
clipping distortions caused by the power amplifier used in transmitting
the signal. It also means that the signal can be purposely clipped by up
to 6 dB so that the peak to RMS ratio can be reduced allowing an increased
transmitted power
Figure
18 Effect of peak power clipping for OFDM
2.2.3 Gaussian Noise Tolerance of OFDM
It was found that the SNR performance of
OFDM is similar to a standard single carrier digital transmission. This
is to be expected, as the transmitted signal is similar to a standard Frequency
Division Multiplexing (FDM) system. Figure 1 shows the results from the
simulations. The results show that using QPSK the transmission can tolerate
a SNR of >10-12 dB. The bit error rate BER gets rapidly worse as the SNR
drops below 6 dB. However, using BPSK allows the BER to be improved in
a noisy channel, at the expense of transmission data capacity. Using BPSK
the OFDM transmission can tolerate a SNR of >6-8 dB. In a low noise link,
using 16PSK can increase the capacity. If the SNR is >25 dB 16PSK can be
used, doubling the data capacity compared with QPSK
Figure
19 BER verse SNR for OFDM using BSPK, QPSK and 16PSK
(Errata 10/2001:
The simulation results shown in Figure 19 are slightly incorrect due to
the calculation of the noise level in the simulation. The simulations shown
above calculated the signal to noise ratio based on the power of the time
domain signal waveform and the power of the time domain noise waveform,
with no consideration of the signal bandwidth. At the receiver the signal
is filtered by the FFT stage, thus making the receiver only see noise within
the signal bandwidth. The simulations were performed using 800 carriers
and generated using a 2048-point IFFT. The nyquist bandwidth is half the
transmission sample rate as the signal is real (i.e. no imaginary components)
and so the nyquist bandwidth corresponds to 1024 carriers. The signal bandwidth
is thus 800/1024 = 0.781 or 78.1% of the nyquist bandwidth. Since the receiver
was only seeing 78.1% of the total noise the error rate is lower than it
should be. The correct SNR values can be found by adding 1.07 dB (10.log10(0.781))
to the scale in Figure 19. Also note the simulation results actually show
the Symbol Error Rate rather than the Bit Error Rate).
2.2.4 Timing Requirements
One of the big questions at the start of
the thesis was how tolerant OFDM would be to a starting time error. The
problem was that when an OFDM receiver is initially switched on it will
not be synchronized with the transmitted signal. So a synchronization method
was required. The proposed method was that the OFDM signal could be broken
up into frames, where each frame transmits a number of symbols (somewhere
between 10-1000). At the start of each frame a null symbol is transmitted,
thus allowing the start of the frame to be detected using envelope detection.
However using envelope detection only allows the start to be detected to
within a couple of sample, depending on the noise in the system. It was
not known whether this timing accuracy was sufficient. This method was
used for the synchronization in the practical tests performed. (See section
2.3)
Figure 20 shows the effect of start time
error on the received BER. This shows that the starting time can have an
error of up to 256 samples before there is any effect of the BER. This
length matches the cyclic extension period of the guard interval, and is
due to the guard period maintaining the orthogonality of the signal
In any practical system, the timing error
made be either early or late, thus any receiver would aim for the middle
of the expected starting time to allow for an error of ±128 samples.
In addition, if the signal is subject to any multipath delay spread, this
will reduce the effective stable time of the guard period, thus reducing
the starting time error tolerance
Figure
20 Effect of frame synchronization error on the received OFDM signal.
2.3
Practical Measurements
A set of practical measurements was made
on the OFDM system. This was done so that the simulated results could be
partly verified and so that difficulties in implementing a practical system
could be tackled, and to measure some effects which were hard to simulate.
The practical measurements were performed
using a Personal Computer (PC) as an OFDM generator and receiver. A Matlab
program was developed to process the input and output signals and a Sound
Blaster 16 card was used to play the transmitted OFDM signal, and used
to record the received signal. Only one PC was available with a sound card
and so the transmission was performed in two steps. The transmitted signal
was generated using Matlab then played out the sound card and recorded
onto an audio recorder. This signal was then played back and re-recorded
by the sound card on the computer. The received signal was then processed
using a Matlab script. Two different audio recorders were tested, as each
gave a different performance.
The first used was the HiFi stereo audio
track on a high quality VCR (Panasonic Super-VHS FS90). This gave a high
quality audio channel (SNR >90dB, 20Hz - 20kHz range, and crystal accuracy
stability of frequency (0.005%)), which was a good model for a near perfect
radio channel
The system was also tested using an audio
tape player. The tape player had a much poorer performance, in noise (~50dB
SNR), audio bandwidth (20Hz-15kHz), and particularly frequency stability
(2%). This provided a good test of the performance of OFDM in a channel
with very poor frequency stability
2.3.1
Extended Model
The basic OFDM model used for the simulations
(see section 2.1) was extended to allow for the received signal to be automatically
be synchronized to the OFDM frame structure, and for large data files to
be able to be transmitted.
2.3.2
Transmission Protocol
A basic frame structure was used to allow
the receiver to synchronize with the transmitted signal. The frames were
marked out by having a null symbol (zero amplitude) between frames (see
Figure 21), allowing the start of each frame to be detected using an envelope
detector in software. The transmitted signal consisted of a number of frames
(typically 1- 100), with a preamble at the start and a post signal at the
end (see Figure 22). The preamble was used to provide the start time of
the first frame and consisted on a mixture of tones. This was required
so that the envelope detector had a signal to initialise the filtering
required.
Figure
21 Frame Structure, showing the null symbol between frames
The envelope detector was implemented by
rectifying the input signal then applying a moving average filter to the
signal. The length of the filter was made exactly the same length as the
null symbol. This results in the filtered signal having a minimum amplitude
at the start of a frame. This minimum was used to find the starting location
in which to decode the entire frame. Each frame consists of a number of
symbols (typically 5-40) that contain the actual data
Figure
22 Frame Structure used for the OFDM transmission
2.3.3
Video Recorder
The first simulated channel used was the
audio track of a VCR
<IP_ADDRESS>
Number of Carriers Used
For an OFDM system, the number of carriers
used in the transmission determines several parameters about the system.
These include the processing speed required, the symbol time (thus the
maximum delay spread that can be tolerated), the number of users the available
bandwidth can be split over (i.e. one carrier per user), and the frequency
stability required.
Since there was no easy way of simulating
this effect with the Matlab model developed, it was decided to measure
it in a practical way. This was done by varying the number of carriers
used when transmitting the OFDM over the link simulated by the VCR. The
frequency stability of the VCRís recording and playing was considered to
be approximately the same for each of the tests performed. This allowed
the relative effect of varying the number of carriers for a fixed frequency
stability.
The data used in the transmission was that
of a grey-scale bit-map image of a fish. The original of the image is show
below in Figure 23
Figure
23 Image used in transmission tests
The transmission was sent using 256PSK.
This was chosen because it gave the highest transmission efficiency (~8
bits/Hz), thus resulting in the smallest transmission data size. By sending
each 8-bit grey scale pixels as one carrier per symbols, any phase errors
in the transmission directly correspond to a change in the intensity of
the received signal. This allows the phase angle errors to be judged from
the image quality. Since the phase error due to a frequency offset or phase
noise has the same effect on the received data as gaussian noise, it can
be effectively converted to an equivalent signal to noise ratio of the
received image.
The image quality and phase error was measured
at different number of carriers used to transmit the signal.
Figure
24 Performance of the OFDM using the VCR as a channel, as a function of
the number of carriers used
Figure 24 show the effect that increasing
the number of carriers had on the received signal. It can be seen that
the larger the FFT size (and number of carriers used), the worse the performance
of the system. This is due to the VCR having a fixed frequency stability
thus the closer the carriers are in the transmission, the worse the effect
of the frequency error. The SNR of the received image for an FFT size of
2048 was only 20 dB. This is much worse then the SNR ratio that would be
expected from the channel noise. The VCR has excellent noise performance
(>70-90 dB SNR for gaussian noise) however this limit is no where near
reached due to frequency stability problems causing an effective SNR of
between 10-3 0dB. This indicates that the performance of the system is
not limited by the gaussian noise of the system, but the frequency stability
Since the frequency stability of the is
such a problem in an practical radio OFDM system the receiver would have
to be frequency locked to the transmitter in order achieve the maximum
performance
| Received Image from VCR audio channel |
Error in received image (contrast enhanced to show the errors) |
16384 point FFT, 5600 carriers |
16384 point FFT, 5600 carriers |
256 point FFT, 75 carriers |
256 point FFT, 75 carriers |
Table
10 Received OFDM images using the audio channel of a VCR
Table 10 shows some of the received images
that were used to generate Figure 24. It can be seen that the image transmitted
using 5600 carriers has bands in the image, due to the phase errors (and
thus pixel intensity errors) in the transmission. Also some of the pixels
that are white (on the top of the fish) have wrapped round to show white.
This is due to the received phase error causing a wrap around from 255
to 0 in intensity
2.3.4
Peak OFDM Performance for the VCR link
After trying out different OFDM system
parameters such as the number of carriers used, system bandwidth and guard
period length, it was found that very high spectral efficiency could be
achieved. Figure 25 shows the maximum performance that could be achieved
on the VCR audio track.
Figure
25 Image transferred at 134kbps in an 18.2kHz bandwidth on the VCR audio
channel, using 210 carriers.
The image of the fish was transferred using
256PSK. The total transmission time was 4.54 seconds for 76246 bytes of
data, with only 18.2 kHz bandwidth. This gives a spectral efficiency of
7.4 bits/Hz. This is just under the theoretical limit of 8 bits/Hz for
256PSK and is due to overhead in the guard period and frame symbols. The
signal was generated using a 512-point FFT, using 210 carriers, and a guard
period of 32 samples. The carriers used were based on the frequency response
of the VCR link measured in section <IP_ADDRESS>, so that the maximum bandwidth
could be used
The received image in Figure 25 has slight
phase errors, which are just noticeable as bands in the image. Also some
pixel on the top fin of the fish have wrapped around from white to black.
<IP_ADDRESS> Peak Power Clipping
The clipping tolerance of the OFDM signal
was tested to verify that OFDM can handle a large amount of peak power
clipping before any significant increase in the bit error rate (BER) occurs.
The simulations indicated that OFDM could handle up to 9 dB of clipping
(for QPSK) before the BER became detectable. This result was slightly surprising
as any non-linearity in the system lead to intermodulation distortion.
Thus the initial expectation was that OFDM would be susceptible to any
clipping of the signal
The clipping of the signal was performed
during the recording from the VCR back to the computer for decoding. The
clipping of the signal was achieved by using back- to-back germanium diodes
across at the output of the VCR with a resistor in series with the VCR
to limit the current flow. The signal was observed on a CRO and increased
in amplitude until clipping occurred. The peak power clipping was measured
by finding the ratio of the peak signal level before clipping, to the peak
signal level after clipping
| Peak Signal before clipping  (Vp-p) |
Peak Signal after clipping (Vp-p) |
Calculated Peak Power Clipping (dB) |
Measured BER of received signal |
Predicted BER from simulation |
| 1.45 |
0.72 |
6.08 |
<0.00006 |
|
| 1.88 |
0.80 |
7.45 |
<0.00006 |
|
| 2.01 |
0.805 |
7.95 |
<0.00006 |
|
| 2.65 |
0.853 |
9.85 |
0.0004 |
<0.00009 |
| 3.55 |
0.917 |
11.8 |
0.0036 |
0.0038 |
| 4.6 |
0.935 |
13.84 |
0.0125 |
0.0208 |
Table 11 Results of clipping the OFDM signal, showing the resulting BER
Table 11 shows the measured error rates
when the signal was clipped, and the expected BER based on the simulations.
The BER was found to be too small (<0.00006) for peak power clipping
up to 8 dB. The BER was only detectable for peak power clipping of >8-10
dB, matching the expected result of 9 dB measured from the simulations
(see section 2.2.2). For high levels of clipping, from 12- 14 dB, the measured
BER was actually lower then the simulated results. This is probably due
to the fact that the germanian diodes used for clipping of the signal were
not clipping as abruptly as in the simulation resulting in lower intermodulation
distortion and a lower BER.
<IP_ADDRESS> VCR performance
The audio performance of the VCR link was
measured so that the quality of the channel used for the practical measurements
could be assessed. The loop back frequency response of the channel was
measured by using the sound card to generate white noise. This noise was
then recorded on the VCR, then played back and recorded back on to the
computer. The power spectral density of the noise was then measured giving
an estimate frequency response of the system. Since the signal was generated
from the sound card the measured frequency response is the combined performance
of the Sound Blaster 16 card and the VCR.
Figure 26 shows the frequency response
of the VCR link used.
The frequency stability of the VCR is quoted
by the manufacturer as 0.005%. This was verified by recording a 10 kHz
sine wave on to the VCR using the sound card to generate the signal. The
frequency of the played back signal was measured using a frequency meter.
It was found that the played back signal to be stable to better then the
resolution of the frequency meter used (i.e. 10.000 kHz). Thus the sound
card, VCR combination was stable to better then 0.01%
Figure 26 Record / Play back frequency response of the Panasonic FS90 VCR / Sound
Blaster 16 combination using a sample rate of 44.1kHz
2.3.5 Audio Tape Player
After much success in using the VCR as
a link, the OFDM system was also tested using an audio tape player as the
channel. The audio tape player used is not frequency locked, as with the
VCR, thus has a very poor frequency stability. This can lead to a large
frequency offset error in the recording. Since OFDM is very susceptible
to frequency offset errors, the performance of the system was poor on the
tape player
<IP_ADDRESS> Carrier Number
Several test OFDM transmissions were tried
using the tape player as a channel. It was found that the only way to successfully
store an image on the tape player was to greatly reduce the number of carriers
used. Table 12 shows two images that were recorded on the audiotape play
then recorded and decoded back onto the computer. It can be seen that the
image quality when using only 5 carriers was much better than using 21
carriers. The image transmitted using 21 carriers, has lines and smears
through it due to phase errors. This is due to the frequency instability
of the tape player.
| Received Image |
Spectrum of the received signal |
64 point FFT, 21 carriers |
(Click the image for a larger version)
|
16 point FFT, 5 carriers
|
(Click the image for a larger version)
|
Table 12 Received images from the audio tape player, using OFDM with 5 and 21
carriers.
<IP_ADDRESS> Tape Player Performance
The frequency stability and frequency response
of the tape player were measured to assess the effective quality of the
channel. All tests were performed using the audio tape player in conjunction
with the Sound Blaster 16 card, thus the measurements are the combination
of their performances
The measurements were performed using the
same technique used for performance measurement of the VCR (see section
<IP_ADDRESS>).
Frequency Stability
A 10 kHz tone was generated using the sound
card by playing a windows 3.1 WAV file generated by a Matlab script. This
tone was then recorded on the tape player. The frequency and amplitude
of the played back signal was then measured over a 10 second period. This
time length was used because it was approximately the same length of time
that is taken in transmitting the fish image. The results are shown below
in Table 13
| |
Frequency (kHz) |
Amplitude Variation (dB) |
| Max |
10.000 |
0.21 |
| Mean |
9.987 |
0.01 |
| Min |
9.823 |
-0.25 |
Table 13 Frequency and amplitude fluctuations in a 10second, 10kHz tone played
back from the audio tape player
Thus the frequency offset is -0.13% and
the variation is 1.77%. The level of frequency instability is very high
as even for only 21 carriers this represents the carrier frequencies shifting
by up to 40% of a carrier spacing. This frequency instability would cause
large phase errors to occur
Frequency Response
The tape player / Sound Blaster 16 frequency
response is shown below in Figure 27. The bandwidth of the tape player
is about 15 kHz, plus the response is reasonably flat (± 3 dB).
The frequency response of the tape player should not cause any significant
problems for the OFDM signal
Figure
27 Record / Play back frequency response of the JVC TD-W444 / Sound Blaster
16 with a sample rate of 44.1kHz
2.4
Picture quality verse signal to noise ratio
This section describes some work that was
done relating to improving the degradation performance of OFDM when the
channel noise becomes very high. One problem with many digital communication
systems is that the performance of the system is fine, up to some critical
channel noise level, above which the system fails very quickly. This can
cause potential problems for wireless telecommunications where the received
signal quality can vary greatly depending of the location of the mobile
station. This problem leads to drop outs in the signal, decreasing the
reliability of the system. It would be far better if the system simply
gave a worse voice or image quality under high noise conditions, rather
then completely loosing the signal
It was noticed when doing the practical
measurements on OFDM (see section 2.3) that the received quality of the
image was very good using 256PSK even though the measured error rate was
very high. Using 256PSK to transmit the image is similar to sending an
analog transmission as channel noise simply appears as noise in the image.
The main question was, does sending the image using 256PSK result in better
performance then QPSK in a high noise environment? To answer this question,
a simple comparison was set up
2.4.1 Setup
The same Matlab scripts were used for this
test as in the previous practical measurements, however the signal wasnít
recorded to any external audio channel as in the practical tests. The channel
noise was simulated using the same model as used in the OFDM simulations
(see section 2.1). The signal to noise ratio (SNR) of the channel was varied
from 0 dB up to 15 dB, with the image quality measured at 3 dB increments.
No forward error correction was used for either modulation technique
Using 256PSK allows 8 bits to be sent on
each carrier per symbol, compared to only 2 bits for QPSK. Thus, 256PSK
on its own allows for up to 4 times the transmission data rate. Since the
aim of the experiment was to compare the relative performance differences
between QPSK and 256PSK under the same transmission bandwidth and data
rate, the 256PSK transmission was slowed down by 4 times to have the same
transmission rate. This was achieved by repeating the 256PSK symbols four
times, thus reducing the data rate to the same as using QPSK. The four
repetitions were then combined at the receiver by averaging the received
demodulated phase angle. This averaging reduces the received phase noise
by up to 6 dB.
Transmitting the signal using 256PSK with
linear mapping of the pixel intensity is very similar to transmitting the
imaging in an analog manner. This modulation technique is essentially linear
Phase Modulation. Transmitting the signal in an analog manner result in
a direct mapping between phase errors caused by the channel, and amplitude
noise (pixel intensity) in the received image. Using a linear mapping tends
to reduce the chance of the large catastrophic errors that can occur when
sending digital data that is not mapped in a linear manner.
However when transmitting using a standard
digital modulation technique such as QPSK, the SNR of the demodulated image
can be much higher then the channel SNR, provided the channel SNR is greater
then ~10 dB. This is because small phase errors are not big enough to cause
a bit error and thus no noise is seen on the received signal. However when
the SNR of the channel becomes worse (< 10 dB), phase errors cause the
received signal to be misread thus causing bit errors. Since the mapping
of the bits to the amplitude of the transmitted signal are not linearly
related, a single bit error can cause a significant error in received amplitude.
This results in a rapid drop in performance of the received signal as the
SNR of the channel drops below ~10 dB for QPSK.
2.4.2 Results
Figure 28 shows how the signal to noise
of the received image decreases as the signal to noise ratio of the transmission
channel also worsens. It can be seen that the 256PSK signal performs better
then the QPSK transmission below a channel SNR of 9 dB.
Figure 28 Comparison between the received image SNR using QPSK and 256PSK verses
the SNR.
For a channel SNR of 0 - 6 dB the 256PSK
signal averaged approximately 7 - 9 dB better picture quality then the
QPSK signal. This gain is to be expected as there are two reasons for the
improvement. Firstly, the signal has been averaged (thus reducing the phase
noise), and that the phase angle mapping used for 256PSK, as the 256PSK
signal is averaged over 4 repeats, giving approximately a 6 dB improvement
compared with the channel SNR.
Table 14 shows some of the received images.
It is easy to see that the image quality of the signal transmitted using
256PSK is much better then using QPSK
| QPSK |
256 PSK with 4 times data averaging |
| SNR = 12dB |
SNR = 12dB |
| SNR = 6dB |
SNR = 6dB |
| SNR = 0dB |
SNR = 0dB |
Table 14 Comparison between QPSK and 256PSK for transmitting an image under noisy
conditions.
It was found that the picture sent using
QPSK had a much better quality then the 256PSK signal in a low noise channel,
where as the 256PSK performed better then QPSK under high noise conditions
with a SNR < 9 dB.
Note: the performance of the QPSK signal
can be significantly improved using advanced forward error correction techniques.
This however cannot be applied to 256PSK using these same techniques as
the matching between the phase mapping and the pixel intensity will be
lost and the error is too high (typically 0.8-0.95 for SNR <12 dB) for
most error correction to work successfully. The use of forward error correction
techniques may result in the performance of QPSK and 256PSK being the same
or QPSK performing better
2.5 Mathematical Model for OFDM performance
The aim was to develop a mathematical model
of the performance (BER) of OFDM verses the channel noise. This was so
that the simulated results could be verified, and to get a more in depth
understanding of the transmission mechanism.
The model developed is based on the transmission
modulation technique being phase shift keying, and that the channel noise
is gaussian noise (i.e. white noise)
2.5.1 RMS Demodulated Phase Error
If we assume that the transmission modulation
method used is phase shift keyed then any noise added to the transmitted
signal will result in a phase error. If we look at the IQ diagram of the
transmitted signal then the transmitted signal will be a phasor of fixed
magnitude, and of phase corresponding to the data to be transmitted. The
noise can then be considered as the random vector added to the transmitted
signal. The magnitude of the phase error depends on two things, the relative
phase angle of the noise vector, and the magnitude of the noise vector
The received vector will be the vector sum
of the transmitted signal and the noise. If we assume that the noise is
a constant magnitude vector equal to its RMS magnitude, and that it has
a random phase angle then the problem of working out the received angle
would be as follows
2.5.2 BER verses Channel Noise
Figure 29 show the effect of noise on the
received phase angle. If we let the amplitude of the transmitted signal
be 1, and the length of the noise vector be A with angle f, then the received
phase error is θerr.
Figure 29 Received Phasor, showing effect of noise on the received phase angle.
Using trigonometry,
Since,
Therefore,
The signal to ratio determines the relative
amplitude of the received signal and the noise level. Since the signal
is scaled to an amplitude of 1, the amplitude of the noise is:
Note: The SNR is base on the amplitudes
of the signals thus must be scaled correctly when converting it to dB
If we substitute this in we get,
The noise signal can be of any phase angle.
What we need is to find is the RMS phase error, so if we find the average
phase error (assuming the noise phase angle is always positive) then this
can be scaled to find the RMS error. The average phase angle can be found
by integrating θerrover
a half circle, i.e j varies
from 0 to p
The RMS phase error will be greater by root 2, thus
Equation 1
This equation was was used to predict the
RMS phase error for different channel SNRs. This was compared with the
results obtained using the simulation of OFDM. Figure 30 shows that the
predicted results based on the above mathematical derivation match the
simulated results very well
Figure 30 Comparison between the measured RMS phase error using the simulations
and the predicted result. (Also shown in Table 22)
Once the RMS phase error has been calculated
the BER can be easily calculated using simple statistics. The RMS phase
error is the standard deviation of the phase error. An error will occur
if the phase error gets bigger then the maximum allowed for the modulation
method used. Thus the BER can be determined by finding the probability
of the phase error being greater the plus, minus the maximum phase error
for a standard deviation equal to the RMS phase error. This is outlined
in the following example
The Bit Error Rate (BER) of an OFDM link
can be predicted based on the channel signal to noise ratio (SNR) and phase
modulation used (e.g. BPSK, QPSK, etc). This is done by finding out what
the expected RMS phase error (θerror(rms))
there will be on the signal (due to the channel noise). The bit error rate can
then be found by comparing the magnitude of the RMS phase error to that
of the maximum phase allowed for the particular phase modulation used
(θmax).
2.5.3 Maximum Allowable Phase Angle
θmax is
the maximum phase error allowed on the received symbol, before an error
will occur on the received word
Figure 31 IQ diagram for QPSK, showing the phase locations for data (crosses)
and that θmax
is 45 degrees
| Modulation Technique |
Maximum Phase Error Allowed θmax in degrees |
| BPSK |
90 |
| QPSK |
45 |
| 16PSK |
11.25 |
| 256PSK |
0.70313 |
Once θmax and θerror(rms)
have been established, Z can be calculated, and the BER found from Table
22
Example
For a QPSK transmission if the signal
to noise ratio (SNR) of the channel is 10dB, find the BER:
Note: Table 21 shows a summary calculated
from Equation 1
From Table 21, θerror(rms)=16.5 degrees,
For QPSK,θmax=45 degrees,
Therefore,
From Table 22 the BER is between 0.0053
and 0.0091, with a result of 0.0077 if the results are interpolated
2.6 OFDM system implementation
The proposed final application for OFDM
is to use it for wireless communications systems such as cellular mobile
phone systems, fixed wireless phone systems, wireless data links and wireless
computer local area networks. If OFDM is to be used in any of these applications
then the bandwidth used must be sufficiently high to compete with other
radio technologies. This section discusses the processing power required
to implement a practical OFDM system
An OFDM system mainly involves digital
signal processing, thus the main focus of the performance of the system
depends on the availability of high performance signal processing. There
are two main ways in which the OFDM signal can be processed, which are
using a general purpose DSP, or by implementing the processing in hardware
using customized ICís.
2.6.1 Using general purpose DSPs
There are several processing stages required
to generate and receive an OFDM signal. However most of the processing
is required in performing the Fast Fourier Transform (FFT).
The complexity of performing an FFT is
dependent on the size of the FFT. The larger the FFT the greater the number
of calculations required, however since as the symbol period is longer
the increased processing required is less then the straight increase in
processing to perform a single FFT. Table 15 shows the number of calculations
required for an FFT (radix-2) of size N, and also the relative processing
for various FFT sizes. It can be seen that because the symbol period increases
with a larger FFT that the extra processing required is minimal
| Size FFT (N) |
Total number of complex calculations (values from [21]) |
Relative processing required for OFDM generation (normalized to 1024 point FFT) |
| 32 |
240 |
0.5 |
| 64 |
576 |
0.6 |
| 128 |
1344 |
0.7 |
| 256 |
3072 |
0.8 |
| 512 |
6912 |
0.9 |
| 1024 |
15360 |
1.0 |
| 2048 |
33792 |
1.1 |
| 4096 |
73728 |
1.2 |
Table 15 Processing complexity for FFT
The processing efficiency of a DSP processor
depends on the architecture of the processor, however for most single instruction
DSPís the number of cycles required to calculate an FFT is twice the total
number of calculations shown in Table 15. This is due to complex calculations
requiring two operations per calculation
Required Processing Power
To get an estimate of the processing power
required to implement a practical phone system, lets consider an example
| Basic System Parameter |
Value |
| Total Bandwidth |
1.25MHz |
| User Capacity |
64 users |
| Modulation Used |
QPSK |
| FFT size |
2048 |
| Guard period |
512 samples |
Table 16 Example OFDM system
Table 16 shows a example system. From these
basic system parameters the required number of carriers, user data rate
and symbol rate can be calculated. These are shown in
| Derived System Parameter |
Value |
| No. of active carriers |
832 |
| Data Rate of each User |
39 kbps |
| Useful symbol time |
666 msec |
| Total symbol time |
833 msec |
Table 17 Derived system parameters for the example OFDM system
From Table 15 the number of complex calculations
required for a 2048 point FFT is 33792. The maximum time that can be taken
in performing the calculation is once every symbol thus once every 833 msec.
If we assume that the processor used requires 2 instructions to perform
a single complex calculation, and that there is an overhead of 30% for
scheduling of tasks and other processing. The minimum processing power
required for this is then:
Thus the transmitter requires >105MIPS
in order to implement to OFDM transmitter. The receiver will require just
as much as the transmitter, thus a full OFDM transceiver will require >210MIPS.
This is a lot of processing required. Most current cheap DSPs are only
25-50MIPS (i.e. AD2181 is 33MIPS). Currently the fastest general purpose
DSP is produced by Texas Instruments. The TMS320C62xx is capable of up
to 1600MIPS which would make it plently fast enough for an OFDM transceiver.
However, the price of the TSM320C62xx is not known and is expected to be
very expensive
(Addendum 10/2001:
Texas Instruments are now producing the TMS320C64xx, which is the next
generation of fixed point DSPís. These processors are capable of up to
4800 MIPS).
OFDM clearly requires a large amount of
porcessing power, however since computer technology is advancing so fast
this may not become a problem in the future
2.6.2 Future DSP Processing Power
Computer technology, and signal processing
technology is improving at a rapid rate. The IC industry is on a self-prescribed
course of development of ever-smaller devices and faster circuits. By the
year 2000, logic IC will employ up to 60 million transistors and operate
at speeds of over 1GHz.
Figure 32 shows the expected performance
increase in general purpose microprocessors until the year 2010. If this
is considered as an indicator for DSP improvement in speed, this shows
that for the next 5 years we can expect a speed improvement in processing
of greater than 5 times. Thus an OFDM system will be easily achievable
using general purpose DSPs in 5 years time
(Addendum 10/2001:
Texas Instruments announced during 1999 that they predict that by 2010,
Digital Signal Processors will be capable of more than 1 Trillion Operations
Per Second, www.ti.com/sc/docs/news/1999/99086.htm)
Figure 32 The performance of general-purpose microprocessors will climb from 100
million operations per second in 1995 to more than 10 billion by 2010 (Source
[20])
2.6.3 Hardware FFT Implementation
Another way of implementing the FFT processing
required for generating and receiving the OFDM signal is by doing the FFTs
in hardware using FFT ICís. Several 1024 point FFT chips are shown in Table
18. For the previos example a 2048 point FFT needed to be performed in
less then 830 msec.
This is much greater then the execution time required by any of the FFT
Ics in Table 18. Although these Ics only perform a 1024point FFT, clearly
the processing can be easily achieved using hardware implementation of
the FFT processing
| Processor |
Year |
Datapath Width (bits) |
Execution Time (1024-pt FFT) |
Number of Chips Required |
Pins |
Power (mW) |
| Cobra (Colorada State) |
1994 |
23 |
9.5 msec |
>16 |
391 |
7700 |
| PDSP16510A (Plessey) |
1989 |
16 |
98 msec |
1 |
84 |
3000 |
| DSP-24 (DSP Architectures) |
1997 |
24 |
21 msec |
7 |
308 |
3500+ |
| Spiffe ULP (Stanford) |
1995 |
20 |
61 msec |
1 |
70 |
8 |
Table 18 1024 point FFT Chip Comparison
Next Chapter 3
|


{% extends "layout_task-list.html" %} {% block page_title %} Money Claims Prototype {% endblock %} {% block home_link %} ../task-list {% endblock %} {% block proposition_header %} {% set my_account="1" %} {% include "includes/propositional_navigation.html" %} {% endblock %} {% block content %} {% include "includes/phase_banner_beta.html" %} Back Get the business's full legal name right Some businesses use a trading name which is different to their full legal name. Your claim will fail if you use this 'trading name' or any name a company is 'trading as'. You can check a business's terms and conditions to find its full legal name. If you find, for example: "Saga Holidays is a trading name of ST&H Group Limited" - claim against 'ST&H Group Limited' "TK Maxx is owned and operated by TJX UK" claim against 'TJX UK' {% include 'prototypes/prototype-jun-2019/includes/contact.html' %} {% endblock %}
Some businesses use a trading name which is different to their full legal name.
Your claim will fail if you use this 'trading name' or any name a company is 'trading as'.
You can check a business's terms and conditions to find its full legal name.
If you find, for example:


Tools▽
Minigames▽
Workshops▽
Other▽
Deprecated▽
Previews▽
📂 Open Folder
Home
Changelog
Control Panel
Account
Credits
Quit App
MultyTool
GitHub Discord
Latest Changes
Loading changelog...
Upcoming Changes
Loading upcoming...

MultyTool
Please come back at a later time, this feature isn't finished yet.
This tab will contain:
Themes
Language-options (very big maybe)
Developer mode(enables devtools and other extras)
Reset all settings to default
And more, this is just all i could think of on the spot.
Please come back at a later time, this feature isn't finished yet.
This tab will contain:
Themes
Language-options (very big maybe)
Developer mode(enables devtools and other extras)
Reset all settings to default
And more, this is just all i could think of on the spot.
MultyTool
It seems like you don't have an account yet. You can create an account here for things like custom settings.
It seems like you don't have an account yet. You can create an account here for things like custom settings.
MultyTool
This app was made using:
Electron:
Chromium:
Node:
• CSS
• JavaScript
• nodeJS
• Java
This app was made using:
Chromium:
Node:
About me:
Hi, my name's Holy, or at least that's what my online handle is, I'm a student and making this app in my free time so expect some updates to take a bit longer.
Age: 18
Languages:
• C
• C#
• Assembler
• Arduino
• Processing
• HTML• C#
• Assembler
• Arduino
• Processing
• CSS
• JavaScript
• nodeJS
• Java
Links:
GitHub
Discord
Twitter
Contact me:
Discord


I'm 31 and have been using cannabis regularly for the past 12 years.
The last couple times I smoked Super Pollen (aka the synthetic cannabinoid CP-55,940) in a bowl sandwiched between two pieces of bud (oreo bowl) I experienced mild pain in my lungs possibly associated with airway inflammation or other irritation. Shortly after the second to last time I used Super Pollen I fairly suddenly developed signs of a respiratory infection that included pain when inhaling, possibly blood in my phlegm all tho it was uncertain if this could have come from nasal drainage or not, fatigue, excess sleeping and temperature that was about a degree low for about 4 days. If it was infection and not a side effect of the Super Pollen smoking, I do not actually think the Super Pollen was directly related as I had recently been exposed to several respiratory risk factors but it might have been indirectly related do to immunomodulating properties of many cannabinoids, tho I have not ruled out the possibility that it was somehow directly involved.
Since recovering I have not used anymore Super Pollen until last night. I was at a dinner party and after dinner someone loaded an oreo bowl and passed it around. I had 3 hits off of it. The second and third hits hurt my lungs in a way reminiscent of how they felt when I was 'sick'. It's now been almost 12 hours and my lungs still feel a little tight. In the last few day I had not noticed this lung irritation from smoking bowls of cannabis alone, however when I was 'sick' attempting to smoke plain cannabis did aggravate my lungs.
T-CDXX
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


FtpOptions
Set connection options.
SYNOPSIS
#include <ftplib.h>
int FtpOptions(int opt, long val, netbuf *nControl);
PARAMETERS
- opt
- Specifies the option to change. Valid options are
FTPLIB_CONNMODE, FTPLIB_CALLBACK, FTPLIB_IDLETIME,
FTPLIB_CALLBACKARG, and FTPLIB_CALLBACKBYTES.
- val
- Specifies the new value for the option. The value may need to
by cast to a long.
- nControl
- A handle returned by FtpConnect()
or FtpAccess().
DESCRIPTION
FtpOptions() changes the options for a connection handle. A data
connection inherits the options assigned to the control connection
it is created from. Callbacks are only called on file data
connections.
New programs should
call FtpSetCallback()
and FtpClearCallback() to change
callback options.
The following options and values are recognized.
- FTPLIB_CONNMODE
- Specifies the connection mode. Either FTPLIB_PASSIVE or
FTPLIB_PORT.
- FTPLIB_CALLBACK (deprecated)
- Specifies the address of a user callback routine.
- FTPLIB_IDLETIME (deprecated)
- Specifies the socket idle time in milliseconds that triggers
calling the user's callback routine.
- FTPLIB_CALLBACKARG (deprecated)
- Specifies an argument to pass to the user's callback
routine.
- FTPLIB_CALLBACKBYTES (deprecated)
- Specifies the number of bytes to transfer between calls to the
user's callback routine.
The connection mode tells ftplib if it should use PASV or PORT
to establish data connections. The default is specified as a build
option.
See FtpSetCallback() for a
description of using callbacks.
RETURN VALUE
Returns 1 if a valid option was specified and the value is
legal. Otherwise, returns 0.


{%- for link in linklists.test-this.links -%} {%- assign collection = link.object -%} {%- if collection.published_at == blank -%}
{{ collection.title }} is not published
{{ collection.title }} is published


| Total net profit | -147.76 | Gross profit | 86.68 | Gross loss | -234.44 |
| Profit factor | 0.37 | Expected payoff | -0.65 | ||
| Absolute drawdown | -150.92 | Maximal drawdown (%) | 150.8 (-125666.67%) | ||
| Total trades | 227 | Profit trades (% of total) | 79 (34.8%) | Loss trades (% of total) | 148 (65.2%) |
| Long positions (won %) | 112 (41.07%) | Short positions (won %) | 115 (28.7%) | ||
| Largest | profit trade | 2.78 | loss trade | -3.62 | |
| Average | profit trade | 1.1 | loss trade | -1.58 | |
| Minimum | profit trade | 0.0 | loss trade | -0.01 | |
| Maximum | take profit in pips | 50.9 | stop loss in pips | -55.4 | |
| Average | take profit in pips | 15.7 | stop loss in pips | -25.9 | |
| Minimum | take profit in pips | -16.9 | stop loss in pips | -8.2 | |
| Maximum | Reward-Risk | 3.2 | Duration in minutes | 962 | |
| Average | Reward-Risk | 0.8 | Duration in minutes | 85.1 | |
| Minimum | Reward-Risk | 0.0 | Duration in minutes | 0 | |
| Maximum | consecutive wins (profit in money) | 4.0 (2.35) | consecutive losses (loss in money) | 8.0 (-11.51) | |
| Average | consecutive wins | 1.0 | consecutive losses | 2.0 |
| Total net profit | -57.06 | Gross profit | 44.57 | Gross loss | -101.63 |
| Profit factor | 0.44 | Expected payoff | -0.51 | ||
| Absolute drawdown | -58.6 | Maximal drawdown (%) | 59.99 (4315.83%) | ||
| Total trades | 112 | Profit trades (% of total) | 46 (41.07%) | Loss trades (% of total) | 66 (59.82%) |
| Largest | profit trade | 2.78 | loss trade | -3.62 | |
| Average | profit trade | 0.97 | loss trade | -1.54 | |
| Minimum | profit trade | 0.0 | loss trade | -0.01 | |
| Maximum | take profit in pips | 47.2 | stop loss in pips | -55.4 | |
| Average | take profit in pips | 11.4 | stop loss in pips | -28.7 | |
| Minimum | take profit in pips | -16.9 | stop loss in pips | -10.9 | |
| Maximum | Reward-Risk | 2.0 | Duration in minutes | 962.0 | |
| Average | Reward-Risk | 0.5 | Duration in minutes | 95.8 | |
| Minimum | Reward-Risk | 0.0 | Duration in minutes | 0.0 | |
| Maximum | consecutive wins (profit in money) | 4.0 (1.93) | consecutive losses (loss in money) | 5.0 (-7.22) | |
| Average | consecutive wins | 1.0 | consecutive losses | 2.0 |
| Total net profit | -90.7 | Gross profit | 42.11 | Gross loss | -132.81 |
| Profit factor | 0.32 | Expected payoff | -0.79 | ||
| Absolute drawdown | -93.2 | Maximal drawdown (%) | 92.04 (-7934.48%) | ||
| Total trades | 115 | Profit trades (% of total) | 33 (28.7%) | Loss trades (% of total) | 82 (71.3%) |
| Largest | profit trade | 2.7 | loss trade | -3.57 | |
| Average | profit trade | 1.28 | loss trade | -1.62 | |
| Minimum | profit trade | 0.33 | loss trade | -0.62 | |
| Maximum | take profit in pips | 50.9 | stop loss in pips | -54.1 | |
| Average | take profit in pips | 19.9 | stop loss in pips | -23.1 | |
| Minimum | take profit in pips | -8.6 | stop loss in pips | -8.2 | |
| Maximum | Reward-Risk | 3.2 | Duration in minutes | 798.0 | |
| Average | Reward-Risk | 1.0 | Duration in minutes | 74.7 | |
| Minimum | Reward-Risk | Duration in minutes | 0.0 | ||
| Maximum | consecutive wins (profit in money) | 3.0 (3.58) | consecutive losses (loss in money) | 10.0 (-17.61) | |
| Average | consecutive wins | 1.0 | consecutive losses | 3.0 |


--- layout: default title: Organizing team description: Code for San Francisco organization team. ---
Code for San Francisco is organized by the following individuals along with members of our Leadership Council.
<EMAIL_ADDRESS>All major decisions about Code for San Francisco are made by the organizing team with input from the Leadership Council, which meets once a month.
Code for San Francisco finances are administered under Code for America Labs, Inc.
Have a talk you'd like to give at Code for San Francisco? See our speaker guidelines.