## 1 angina no 181
## 2 angina yes 89
## 3 electro hypertrophy 137
## 4 electro normal 131
## 5 electro STT 2
## 6 heart.disease no 150
## 7 heart.disease yes 120
## 8 high.blood.sugar no 230
## 9 high.blood.sugar yes 40
## 10 pain.type asymptomatic 129
## # … with 11 more rows
then choose the rows with the right thing in variable_name
, and then
pull just the value
column. This is sufficiently like the
previous one that I think we can write a function right away:
get_categories <- function(d, x) {
d %>%
filter(variable_name == x) %>%
pull(value)
}
get_categories(heart3, "electro")
## [1] "hypertrophy" "normal" "STT"
All right, setup, using my usual habit of plural names, and using those functions we just wrote:
sexes <- get_categories(heart3, "sex")
pain.types <- get_categories(heart3, "pain.type")
resting.bps <- get_quartiles(heart2, "resting.bp_")
serum.chols <- get_quartiles(heart2, "serum.chol_")
max.hrs <- get_quartiles(heart2, "max.hr_")
oldpeaks <- get_quartiles(heart2, "oldpeak_")
slopes <- get_categories(heart3, "slope")
coloreds <- get_quartiles(heart2, "colored_")
thals <- get_categories(heart3, "thal")
All combos of all of those (and there will be a lot of those):
heart.new <- crossing(
sex = sexes, pain.type = pain.types, resting.bp = resting.bps,
serum.chol = serum.chols, max.hr = max.hrs, oldpeak = oldpeaks, slope = slopes,
colored = coloreds, thal = thals
)
heart.new
## # A tibble: 2,304 x 9
## sex pain.type resting.bp serum.chol max.hr oldpeak slope colored thal
## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <chr> <dbl> <chr>
## 1 female asymptomatic 120 213 133 0 downsloping 0 fixed
## 2 female asymptomatic 120 213 133 0 downsloping 0 normal
## 3 female asymptomatic 120 213 133 0 downsloping 0 reversible
## 4 female asymptomatic 120 213 133 0 downsloping 1 fixed
## 5 female asymptomatic 120 213 133 0 downsloping 1 normal
## 6 female asymptomatic 120 213 133 0 downsloping 1 reversible
## 7 female asymptomatic 120 213 133 0 flat 0 fixed
## 8 female asymptomatic 120 213 133 0 flat 0 normal
## 9 female asymptomatic 120 213 133 0 flat 0 reversible
## 10 female asymptomatic 120 213 133 0 flat 1 fixed
## # … with 2,294 more rows
Yeah, that’s a lot. Fortunately, we won’t have to look at them all.
\(\blacksquare\)
- Obtain the predicted probabilities of heart disease for
the data frame you constructed in the last part, using your
model that came out of
step
. Add these predictions to the data frame from the previous part (as a column in that data frame).
Solution
Get the predictions, which is less scary than it seems:
and the easiest way to add these to heart.new
is this:
Let’s take a look at a few of the predictions, by way of sanity-checking:
## # A tibble: 8 x 10
## sex pain.type resting.bp serum.chol max.hr oldpeak slope colored thal pred
## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <chr> <dbl> <chr> <dbl>
## 1 male nonanginal 140 280 166 0 upsloping 0 fixed 0.0382
## 2 female asymptomatic 120 280 166 0 upsloping 1 normal 0.118
## 3 male typical 140 213 166 0 flat 1 reversible 0.428
## 4 female nonanginal 140 280 133 0 flat 0 normal 0.0450
## 5 male atypical 140 280 133 1.6 upsloping 1 reversible 0.864
## 6 male typical 120 213 166 1.6 flat 1 reversible 0.494
## 7 female asymptomatic 120 213 166 1.6 flat 0 normal 0.135
## 8 male nonanginal 140 213 133 1.6 downsloping 1 fixed 0.272
This seems at least reasonably sane.
\(\blacksquare\)
- Find the largest predicted probability (which is the predicted probability of heart disease) and display all the variables that it was a prediction for.
 Are they consistent?
Solution
Since we were predicting the probability of heart disease, a
more positive slope in the model from step
will be
associated with a higher probability of heart disease. So,
there, we are looking for a couple of things: if the variable
is a factor, we’re looking for the level with the most
positive slope (bearing in mind that this might be the
baseline), and for a numeric variable, if the slope is
positive, a high value is associated with heart
disease, and if negative, a low value.
Bearing that in mind, we go back to my
summary(heart.3)
and we have:
sex
: being male has the higher risk, by a lotpain
: all the slopes shown are negative, so the highest risk goes with the baseline oneasymptomatic
.resting.bp
: positive slope, so higher risk with higher value.serum.chol
: same.max.hr
: negative slope, so greatest risk with smaller value.oldpeak
: positive slope, greater risk with higher value again.slope
:flat
has greatest risk.colored
: positive slope, so beware of higher value.thal
:reversible
has greatest risk.
Then we can do the same thing for the prediction. For the numerical variables, we may need to check back to the previous part to see whether the value shown was high or low. Once you have done that, you can see that the variable values for the highest predicted probability do indeed match the ones we thought should be the highest risk. The interesting thing about this is that after adjusting for all of the other variables, there is a greater risk of heart disease if you are male (and the model shows that the risk is much greater). That is to say, it’s being male that makes the difference, not the fact that any of the other variables are different for males. Perhaps, therefore, the easiest way to avoid a heart attack is to not be male!
\(\blacksquare\)
26.17 Successful breastfeeding
A regular pregnancy lasts 40 weeks, and a baby that is born at or before 33 weeks is called “premature”. The number of weeks at which a baby is born is called its “gestational age”. Premature babies are usually smaller than normal and may require special care. It is a good sign if, when the mother and baby leave the hospital to go home, the baby is successfully breastfeeding.
The data in link are from a study of 64 premature infants. There are three columns: the gestational age (a whole number of weeks), the number of babies of that gestational age that were successfully breastfeeding when they left the hospital, and the number that were not. (There were multiple babies of the same gestational age, so the 64 babies are summarized in 6 rows of data.)
- Read the data into R and display the data frame.
Solution
No great challenge here, I hope:
##
## ── Column specification ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## cols(
## gest.age = col_double(),
## bf.yes = col_double(),
## bf.no = col_double()
## )
## # A tibble: 6 x 3
## gest.age bf.yes bf.no
## <dbl> <dbl> <dbl>
## 1 28 2 4
## 2 29 2 3
## 3 30 7 2
## 4 31 7 2
## 5 32 16 4
## 6 33 14 1
That looks reasonable.
\(\blacksquare\)
- Verify that there were indeed 64 infants, by having R do a suitable calculation on your data frame that gives the right answer for the right reason.
Solution
The second and third columns are all frequencies, so it’s a question of adding them up.  If it works and it does the right thing, it’s good.
Do not copy the numbers out of your data frame, type them in again and use R to add them up. Do something with your data frame as you read it in.
\(\blacksquare\)
- Do you think, looking at the data, that there is a relationship between gestational age and whether or not the baby was successfully breastfeeding when it left the hospital? Explain briefly.
Solution
The babies with the youngest gestational age (the most premature) were mostly not breastfeeding when they left the hospital. Most of the 30- and 31-week babies were breastfeeding, and almost all of the 32- and 33-week babies were breastfeeding. So I think there will be a relationship: as gestational age increases, the probability that the baby will be breastfeeding will also increase. (This, looking ahead, suggests a positive slope in a logistic regression.)
\(\blacksquare\)
- Why is logistic regression a sensible technique to use here? Explain briefly.
Solution
The response variable is a yes/no: whether or not an infant is breastfeeding. We want to predict the probability of the response being in one or the other category. This is what logistic regression does. (The explanatory variable(s) are usually numerical, as here, but they could be factors as well, or a mixture. The key is the kind of response. The number of babies that are successfully breastfeeding at a certain gestational age is modelled as binomial with \(n\) being the total number of babies of that gestational age, and \(p\) being something that might depend, and here does depend, on gestational age.)
\(\blacksquare\)
- Fit a logistic regression to predict the probability that an infant will be breastfeeding from its gestational age. Show the output from your logistic regression.
Solution
These are summarized data, rather than one infant per line, so
what we have to do is to make a two-column response “matrix”,
successes in the first column and failures in the second, and then
predict that from gestational age. (That’s why this was
three marks rather than two.)
So, let’s make the response
first:
## bf.yes bf.no
## [1,] 2 4
## [2,] 2 3
## [3,] 7 2
## [4,] 7 2
## [5,] 16 4
## [6,] 14 1
or, more Tidyverse-like, but we have to remember to turn it into a
matrix
:
## bf.yes bf.no
## [1,] 2 4
## [2,] 2 3
## [3,] 7 2
## [4,] 7 2
## [5,] 16 4
## [6,] 14 1
I used a select-helper, because what immediately came to me was that
the names of the columns I wanted started with bf
, but
whatever way you have that works is good.
Now we fit the logistic regression:
breastfeed.1 <- glm(response ~ gest.age, data = breastfeed, family = "binomial")
summary(breastfeed.1)
##
## Call:
## glm(formula = response ~ gest.age, family = "binomial", data = breastfeed)
##
## Deviance Residuals:
## 1 2 3 4 5 6
## -0.1472 -0.4602 0.8779 0.1114 -0.6119 0.3251
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -16.7198 6.0630 -2.758 0.00582 **
## gest.age 0.5769 0.1977 2.918 0.00352 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 11.1772 on 5 degrees of freedom
## Residual deviance: 1.4968 on 4 degrees of freedom
## AIC: 19.556
##
## Number of Fisher Scoring iterations: 4
\(\blacksquare\)
- Does the significance or non-significance of the slope of
gest.age
surprise you? Explain briefly.
Solution
The slope is significant (P-value 0.0035 is much less than 0.05). We said above that we expected there to be a relationship between gestational age and whether or not the baby was breastfeeding, and this significant slope is confirming that there is a relationship. So this is exactly what we expected to see, and not a surprise at all. If you concluded above that you did not see a relationship, you should colour yourself surprised here. Consistency.
\(\blacksquare\)
- Is your slope (in the
Estimate
column) positive or negative? What does that mean, in terms of gestational ages and breastfeeding? Explain briefly.
Solution
My slope is 0.5769, positive. That means that as the explanatory variable, gestational age, increases, the probability of the event (that the baby is breastfeeding) also increases. This is also what I observed above: almost all of the near-term (large gestational age) babies were breastfeeding, whereas a fair few of the small-gestational-age (very premature) ones were not.
\(\blacksquare\)
- Obtain the predicted probabilities that an infant will successfully breastfeed for each of the gestational ages in the data set, and display them side by side with the observed data.
Solution
This is the easier version of predict
, where you do not
have to create a data frame of values to predict from (since you
are using the original data).
Thus, you only need something like this:
## gest.age bf.yes bf.no p
## 1 28 2 4 0.3620282
## 2 29 2 3 0.5025820
## 3 30 7 2 0.6427290
## 4 31 7 2 0.7620821
## 5 32 16 4 0.8508177
## 6 33 14 1 0.9103511
You can see that the predicted probabilities go steadily up as the gestational age goes up, just as we would have expected.
If you only wanted certain gestational ages, for example 25, 30 and 35, you would do that like this:
ages.new <- data.frame(gest.age = c(25, 30, 35))
p2 <- predict(breastfeed.1, ages.new, type = "response")
cbind(ages.new, p2)
## gest.age p2
## 1 25 0.09134905
## 2 30 0.64272897
## 3 35 0.96987261
Or, if you wanted to make a graph of the observed and predicted proportions/probabilities, you could do something like this:
breastfeed %>%
mutate(
total = bf.yes + bf.no,
obs = bf.yes / total
) %>%
mutate(pred = p) %>%
ggplot(aes(x = gest.age, y = obs)) +
geom_line(aes(y = pred)) + geom_point(aes(size = total))
What did I do there? I first created some new variables:
count
is the total number of babies of each gestational age,
obs
is the observed proportion of breastfeeding babies at
each gestational age (number of yes divided by total), and
pred
which are the predictions we did above. Then I make a
plot on which I plot the observed proportions against gestational age
(as points), and then I want to plot the predictions joined by
lines. To do that, I need to change which \(y\)-variable I am
plotting (now pred
rather than obs
), and the way I
do that is to put an aes
inside the geom_line
to
say “use the \(x\) I had before, but use this \(y\) instead”. I also
wanted to draw attention to the gestational ages where more babies
were observed; I did this by making the size of the plotted
points proportional to how many babies there were at that gestational
age (which was the quantity total
I calculated above). This
took a couple of attempts to get right: I put size=
in the
original aes
, but I didn’t realize that it controlled the
line thickness as well (which looked really weird). So I moved the
geom_point
to the end and put the size=
in there,
to make sure that the size thing only applied to the
points. The legend for total
tells you what size point
corresponds to how many total babies.
The idea is that the observed and predicted should be reasonably close, or at least not grossly different, and I think they are close, which indicates that our model is doing a good job.
\(\blacksquare\)
26.18 Making it over the mountains
In 1846, the Donner party (Donner and Reed families) left Springfield, Illinois for California in covered wagons. After reaching Fort Bridger, Wyoming, the leaders decided to find a new route to Sacramento. They became stranded in the eastern Sierra Nevada mountains at a place now called Donner Pass, when the region was hit by heavy snows in late October. By the time the survivors were rescued on April 21, 1847, 40 out of 87 had died.
After the rescue, the age and gender of each person in the party was recorded, along with whether they survived or not. The data are in link.
- Read in the data and display its structure. Does that agree with the description in the previous paragraph?
Solution
Nothing very new here:
##
## ── Column specification ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## cols(
## age = col_double(),
## gender = col_character(),
## survived = col_character()
## )
## # A tibble: 45 x 3
## age gender survived
## <dbl> <chr> <chr>
## 1 23 male no
## 2 40 female yes
## 3 40 male yes
## 4 30 male no
## 5 28 male no
## 6 40 male no
## 7 45 female no
## 8 62 male no
## 9 65 male no
## 10 45 female no
## # … with 35 more rows
The ages look like ages, and the other variables are categorical as promised, with the right levels. So this looks sensible.
I usually write (or rewrite) the data description myself, but the one I found for these data at link was so nice that I used it as is. You can see that the data format used on that website is not as nice as ours. (I did some work to make it look nicer for you, with proper named categories rather than 0 and 1.)
\(\blacksquare\)
- Make graphical or numerical summaries for each pair of
variables. That is, you should make a graph or numerical summary for
each of
age
vs.gender
,age
vs.
survived
andgender
vs.survived
. In choosing the kind of graph or summary that you will use, bear in mind thatsurvived
andgender
are factors with two levels.
Solution
Thinking about graphs first: we have two numeric-vs-factor graphs
(the ones involving age
), which I think should be
boxplots, though they could be something like side-by-side
histograms (if you are willing to grapple with
facet_grid
). The other two variables are both
factors, so a good graph for them would be something
like a grouped bar plot (as in the question about parasites earlier).
If you prefer numerical summaries: you could do mean age (or some
other summary of age) for each group defined by gender or
survivorship, and you could do a cross-tabulation of frequencies
for gender and survival. I’ll take any mixture of graphs and
numerical summaries that addresses each pair of variables somehow
and summarizes them in a sensible way.
Starting with age
vs. gender
:
or:
or:
## # A tibble: 2 x 2
## gender m
## <chr> <dbl>
## 1 female 31.1
## 2 male 32.2
Age vs. survived
is the same idea:
or:
or:
## # A tibble: 2 x 2
## survived m
## <chr> <dbl>
## 1 no 35.5
## 2 yes 27.2
For survived
against gender
, the obvious thing is a
cross-tabulation, gotten like this:
## survived
## gender no yes
## female 5 10
## male 20 10
or like this:
## `summarise()` has grouped output by 'gender'. You can override using the `.groups` argument.
## # A tibble: 4 x 3
## # Groups: gender [2]
## gender survived n
## <chr> <chr> <int>
## 1 female no 5
## 2 female yes 10
## 3 male no 20
## 4 male yes 10
For a graph, borrow the grouped bar-plot idea from the parasites question:
I think this way around for x
and fill
is better,
since we want to ask something like “out of the females, how many survived”
(that is, gender is explanatory and survival response).
\(\blacksquare\)
- For each of the three graphs or summaries in the previous question, what do they tell you about the relationship between the pair of variables concerned? Explain briefly.
Solution
I think the graphs are the easiest thing to interpret, but use whatever you got:
The females on average were younger than the males. (This was still true with the medians, even though those very old males might have pulled the mean up.)
The people who survived were on average younger than those who didn’t (or, the older people tended not to survive).
A greater proportion of females survived than males.
A relevant point about each relationship is good.
\(\blacksquare\)
- Fit a logistic regression predicting survival from age and gender. Display the summary.
Solution
Each row of the data frame is one person, so we can use the
survived
column without going through that two-column
response business.
However, the response variable survived
is a categorical
variable expressed as text, so we need to make it into a
factor
first. Either create a new variable that is the
factor version of survived
, or do it right in the glm
:
donner.1 <- glm(factor(survived) ~ age + gender, family = "binomial", data = donner)
summary(donner.1)
##
## Call:
## glm(formula = factor(survived) ~ age + gender, family = "binomial",
## data = donner)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.7445 -1.0441 -0.3029 0.8877 2.0472
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.23041 1.38686 2.329 0.0198 *
## age -0.07820 0.03728 -2.097 0.0359 *
## gendermale -1.59729 0.75547 -2.114 0.0345 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 61.827 on 44 degrees of freedom
## Residual deviance: 51.256 on 42 degrees of freedom
## AIC: 57.256
##
## Number of Fisher Scoring iterations: 4
We ought to take a moment to think about what is being predicted here:
## [1] "no" "yes"
The baseline is the first of these, no
, and the thing that is
predicted is the probability of the second one, yes
(that is,
the probability of surviving).
\(\blacksquare\)
- Do both explanatory variables have an impact on survival? Does that seem to be consistent with your numerical or graphical summaries? Explain briefly.
Solution
Both explanatory variables have a P-value (just) less than 0.05, so they both have an impact on survival: taking either one of them out of the logistic regression would be a mistake. To see if this makes sense, go back to your plots or summaries, the ones involving survival. For age, the mean or median age of the survivors was less than for the people who died, by five year (median) or eight years (mean), so it makes sense that there would be an age effect. For gender, two-thirds of the women survived and two-thirds of the men died, so there ought to be a gender effect and is.
\(\blacksquare\)
- Are the men typically older, younger or about the same age as
the women? Considering this, explain carefully what the negative
gendermale
slope in your logistic regression means.
Solution
The men are typically older than the women.
The negative (and significant) gendermale
slope means that
the probability of a male surviving is less than that of a woman
of the same age. Or, though the males are typically
older, even after you allow for that, the males have worse
survival. (genderfemale
is the baseline.)
You need to get at the idea of “all else equal” when you’re
assessing regression slopes of any kind: regular regression,
logistic regression or survival analysis (coming up later). That’s
why I said “carefully” in the question. If I say “carefully” or
“precisely”, a complete answer is looking for a specific thing to
show that you understand the issue completely.
\(\blacksquare\)
- Obtain the median and quartiles of age, and construct a data
frame that contains all combinations of those ages and the two
genders, with columns called exactly
age
andgender
. Use this data frame to obtain predicted probabilities of survival for each of those combinations of age and gender.
Solution
I have a standard way of doing this:
Make a list of all the variable values I’m going to predict for, using plural names
Make a data frame containing all combinations, using
crossing
, giving the columns the right namesFeed this data frame into
predict
, along with a fitted model, and get a column of predictions.Glue those predictions onto the data frame of values to predict for, and display them.
That way I can do it without thinking too hard. There is a lazy way to do step 1 (which I’ll show first), and a way that is more work but more reliable (because you have to concentrate less). Step 1, the lazy way:
## age
## Min. :15.0
## 1st Qu.:24.0
## Median :28.0
## Mean :31.8
## 3rd Qu.:40.0
## Max. :65.0
## # A tibble: 2 x 2
## gender n
## <chr> <int>
## 1 female 15
## 2 male 30
Then construct vectors called ages
and genders
by
literally copying the values output from above:
There is a risk here, because it is very easy to make typos while copying, so it would be more reliable to compute these (and, as long as you trust your computation, reproducible as well). Thinking of reproducibility, if the data set changes, your computation of quartiles etc. will still work, whereas your copying above won’t.
So, let’s get the median and quartiles of age:
## # A tibble: 1 x 3
## q1 med q3
## <dbl> <dbl> <dbl>
## 1 24 28 40
only these came out sideways, so we can “transpose” them:
donner %>%
summarize(
q1 = quantile(age, 0.25),
med = median(age),
q3 = quantile(age, 0.75)
) %>%
pivot_longer(everything(), names_to="stat", values_to="value")
## # A tibble: 3 x 2
## stat value
## <chr> <dbl>
## 1 q1 24
## 2 med 28
## 3 q3 40
and now if we “pull out” the value
column, we are good:
ages <- donner %>%
summarize(
q1 = quantile(age, 0.25),
med = median(age),
q3 = quantile(age, 0.75)
) %>%
pivot_longer(everything(), names_to="stat", values_to="value") %>%
pull(value)
ages
## 25% 75%
## 24 28 40
The same kind of idea will get us both genders without typing any genders:
## [1] "female" "male"
We don’t care how many there are of each gender; it’s just a device to get the different genders.49 This is another way:
## [1] "male" "female"
The rationale behind this one is that distinct()
removes
duplicates (or duplicate combinations if you have more than one
variable), leaving you with only the distinct ones (the ones that are
different from each other).
I don’t think the genders are ever going to change, but it’s the principle of the thing.
Step 2:
## # A tibble: 6 x 2
## age gender
## <dbl> <chr>
## 1 24 female
## 2 24 male
## 3 28 female
## 4 28 male
## 5 40 female
## 6 40 male
All combinations of the three ages and two genders.
Step 3:
## 1 2 3 4 5 6
## 0.7947039 0.4393557 0.7389850 0.3643360 0.5255405 0.1831661
Step 4:
## age gender p
## 1 24 female 0.7947039
## 2 24 male 0.4393557
## 3 28 female 0.7389850
## 4 28 male 0.3643360
## 5 40 female 0.5255405
## 6 40 male 0.1831661
These, remember, are predicted probabilities of surviving.
\(\blacksquare\)
- Do your predictions support your conclusions from earlier about the effects of age and gender? Explain briefly.
Solution
We said before that the probability of survival was lower if the age was higher. This is confirmed here: for example, look at rows 1, 3 and 5, which are all females of increasing ages; the probability of survival decreases. (Or look at males, in rows 2, 4 and 6; the effect is the same.)
To see the effect of gender, look at two predictions of different genders but the same age (eg. rows 1 and 2). The female is always predicted to have the higher survival probability. This is also what we saw before. The effect of gender is substantial, but not strongly significant, because we only have 45 observations, not so many when all we know about each person is whether they survived or not. I wanted you to think about these different ways to understand the model, and to understand that they all say the same thing, in different ways (and thus you can look at whichever of them is most convenient or comprehensible). For the logistic and survival models, I find looking at predictions to be the easiest way to understand what the model is saying.
\(\blacksquare\)
26.19 Who needs the most intensive care?
The “APACHE II” is a scale for assessing patients who arrive in the intensive care unit (ICU) of a hospital. These are seriously ill patients who may die despite the ICU’s best attempts. APACHE stands for “Acute Physiology And Chronic Health Evaluation.”50 The scale score is calculated from several physiological measurements such as body temperature, heart rate and the Glasgow coma scale, as well as the patient’s age. The final result is a score between 0 and 71, with a higher score indicating more severe health issues. Is it true that a patient with a higher APACHE II score has a higher probability of dying?
Data from one hospital are in link. The columns are: the APACHE II score, the total number of patients who had that score, and the number of patients with that score who died.
- Read in and display the data (however much of it displays). Why are you convinced that have the right thing?
Solution
Data values separated by one space, so:
##
## ── Column specification ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## cols(
## apache = col_double(),
## patients = col_double(),
## deaths = col_double()
## )
## # A tibble: 38 x 3
## apache patients deaths
## <dbl> <dbl> <dbl>
## 1 0 1 0
## 2 2 1 0
## 3 3 4 1
## 4 4 11 0
## 5 5 9 3
## 6 6 14 3
## 7 7 12 4
## 8 8 22 5
## 9 9 33 3
## 10 10 19 6
## # … with 28 more rows
I had to stop and think about what to call the data frame, since one
of the columns is called apache
.
Anyway, I appear to have an apache
score between 0 and something, a
number of patients and a number of deaths (that is no bigger than the
number of patients). If you check the original data, the apache
scores go up to 41 and are all the values except for a few near the
end, so it makes perfect sense that there would be 38 rows.
Basically, any comment here is good, as long as you make one and it has something to do with the data.
apache
scores could be as high as 71, but I imagine a patient would
have to be very ill to get a score anywhere near that high.
\(\blacksquare\)
- Does each row of the data frame relate to one patient or sometimes to more than one? Explain briefly.
Solution
Sometimes to more than one. The number in the patients
column says how many patients that line refers to: that is to say
(for example) the row where apache
equals 6 represents
all the patients whose apache
score was 6, however many
of them there were (14 in this case).
I had to be careful with the wording because the first two rows of
the data frame actually do refer to only one patient each
(who survived in both cases), but the later rows do refer to more
than one patient.
\(\blacksquare\)
- Explain why this is the kind of situation where you need a
two-column response, and create this response variable, bearing in
mind that I will (later) want you to estimate the probability of
dying, given the
apache
score.
Solution
This needs a two-column response precisely because each row represents (or could represent) more than one observation. The two columns are the number of observations referring to the event of interest (dying), and the number of observations where that didn’t happen (survived). We don’t actually have the numbers of survivals, but we can calculate these by subtracting from the numbers of patients (since a patient must have either lived or died):
response <- icu %>%
mutate(survivals = patients - deaths) %>%
select(deaths, survivals) %>%
as.matrix()
response
## deaths survivals
## [1,] 0 1
## [2,] 0 1
## [3,] 1 3
## [4,] 0 11
## [5,] 3 6
## [6,] 3 11
## [7,] 4 8
## [8,] 5 17
## [9,] 3 30
## [10,] 6 13
## [11,] 5 26
## [12,] 5 12
## [13,] 13 19
## [14,] 7 18
## [15,] 7 11
## [16,] 8 16
## [17,] 8 19
## [18,] 13 6
## [19,] 7 8
## [20,] 6 7
## [21,] 9 8
## [22,] 12 2
## [23,] 7 6
## [24,] 8 3
## [25,] 8 4
## [26,] 2 4
## [27,] 5 2
## [28,] 1 2
## [29,] 4 3
## [30,] 4 1
## [31,] 3 0
## [32,] 3 0
## [33,] 1 0
## [34,] 1 0
## [35,] 1 0
## [36,] 1 0
## [37,] 1 0
## [38,] 0 1
noting that the deaths column has to come first since that’s
what we want the probability of. It has to be a matrix
, so
as.matrix
is the final step. You can quickly check that the
two numbers in each row add up to the number of patients
for
that row.
Or do everything outside of the data frame:
## deaths survivals
## [1,] 0 1
## [2,] 0 1
## [3,] 1 3
## [4,] 0 11
## [5,] 3 6
## [6,] 3 11
## [7,] 4 8
## [8,] 5 17
## [9,] 3 30
## [10,] 6 13
## [11,] 5 26
## [12,] 5 12
## [13,] 13 19
## [14,] 7 18
## [15,] 7 11
## [16,] 8 16
## [17,] 8 19
## [18,] 13 6
## [19,] 7 8
## [20,] 6 7
## [21,] 9 8
## [22,] 12 2
## [23,] 7 6
## [24,] 8 3
## [25,] 8 4
## [26,] 2 4
## [27,] 5 2
## [28,] 1 2
## [29,] 4 3
## [30,] 4 1
## [31,] 3 0
## [32,] 3 0
## [33,] 1 0
## [34,] 1 0
## [35,] 1 0
## [36,] 1 0
## [37,] 1 0
## [38,] 0 1
## [1] "matrix" "array"
Or use the dollar sign instead of the with
s. Any of those is
good.
I have no objection to your displaying the response matrix.
\(\blacksquare\)
- Fit a logistic regression to estimate the probability of
death from the
apache
score, and display the results.
Solution
##
## Call:
## glm(formula = response ~ apache, family = "binomial", data = icu)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.2508 -0.5662 0.1710 0.6649 2.3695
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.2903 0.2765 -8.282 < 2e-16 ***
## apache 0.1156 0.0160 7.227 4.94e-13 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 106.009 on 37 degrees of freedom
## Residual deviance: 43.999 on 36 degrees of freedom
## AIC: 125.87
##
## Number of Fisher Scoring iterations: 4
My naming convention has gotten messed up again. This should really be
called deaths.1
or something like that, but that would be a
really depressing name.
\(\blacksquare\)
- Is there a significant effect of
apache
score on the probability of survival? Explain briefly.
Solution
A gimme two points. The P-value for apache
is \(4.94 \times 10^{-13}\), very small, so apache
score definitely
has an effect on the probability of survival.
\(\blacksquare\)
- Is the effect of a larger
apache
score to increase or to decrease the probability of death? Explain briefly.
Solution
The slope coefficient for apache
is 0.1156, positive, and
since we are modelling the probability of death (the first column
of the response matrix), this says that as apache
goes
up, the probability of death goes up as well.
If you made your response matrix with the columns the wrong way
around, the slope coefficient for apache
should be
\(-0.1156\), but the explanation should come to the same place,
because this says that the probability of survival goes down as
apache
goes up.
\(\blacksquare\)
- Obtain the predicted probability of death for each of the
apache
scores that were in the data set. Display these predicted probabilities next to theapache
values that they came from. (You can display all of them.)
Solution
This is the easier version of predict
since we don’t have
to make a new data frame of values to predict from:
## apache patients deaths p
## 1 0 1 0 0.09192721
## 2 2 1 0 0.11313881
## 3 3 4 1 0.12526979
## 4 4 11 0 0.13849835
## 5 5 9 3 0.15287970
## 6 6 14 3 0.16846238
## 7 7 12 4 0.18528595
## 8 8 22 5 0.20337870
## 9 9 33 3 0.22275512
## 10 10 19 6 0.24341350
## 11 11 31 5 0.26533372
## 12 12 17 5 0.28847528
## 13 13 32 13 0.31277589
## 14 14 25 7 0.33815068
## 15 15 18 7 0.36449223
## 16 16 24 8 0.39167143
## 17 17 27 8 0.41953937
## 18 18 19 13 0.44793012
## 19 19 15 7 0.47666442
## 20 20 13 6 0.50555404
## 21 21 17 9 0.53440661
## 22 22 14 12 0.56303077
## 23 23 13 7 0.59124118
## 24 24 11 8 0.61886322
## 25 25 12 8 0.64573711
## 26 26 6 2 0.67172126
## 27 27 7 5 0.69669475
## 28 28 3 1 0.72055875
## 29 29 7 4 0.74323712
## 30 30 5 4 0.76467607
## 31 31 3 3 0.78484314
## 32 32 3 3 0.80372553
## 33 33 1 1 0.82132803
## 34 34 1 1 0.83767072
## 35 35 1 1 0.85278652
## 36 36 1 1 0.86671872
## 37 37 1 1 0.87951866
## 38 41 1 0 0.92058988
The type="response"
is needed to make sure the predictions
come out as probabilities. If you omit it, you get log-odds.
The predicted probability (of dying) does indeed go up as
apache
goes up.
\(\blacksquare\)
- Make a plot of predicted death probability against
apache
score (joined by lines) with, also on the plot, the observed proportion of deaths within eachapache
score, plotted againstapache
score. Does there seem to be good agreement between observation and prediction?
Solution
This means calculating the observed proportions first, adding the predicted probabilities, and then making the plot, like this:
icu %>%
mutate(obs_prop = deaths / patients) %>%
mutate(pred = p) %>%
ggplot(aes(x = apache, y = pred)) + geom_line() +
geom_point(aes(y = obs_prop))
You don’t need to make a column in the pipeline with the predictions
in it; you can just use what I called p
directly in the
aes
.
Note that you do need to have a new aes
inside the
geom_point
, however, because the \(y\) of the plot has
changed: it needs to be the observed proportion now.
What you actually have to do in this situation depends on what you
have. In this case, we have the total number of patients at each
apache
score, but you might have the number of patients
surviving in one column and dying in another, in which case you’d need
to calculate the total first.
I’d say the agreement is pretty good, except for the one patient with
apache
of 41 but who somehow survived.
That’s what I asked for, and is full marks if you got it. However, the
points are not all based on the same number of observations. One way
to show that on your plot is to vary the size of the plotted
point51
according to the number of patients it was based on. This is not hard
to do, since we have exactly that in patients
:
icu %>%
mutate(obs_prop = deaths / patients) %>%
mutate(pred = p) %>%
ggplot(aes(x = apache, y = pred)) + geom_line() +
geom_point(aes(y = obs_prop, size = patients))
The points that are far from the prediction are mostly based on a
small number of patients, and the observed proportions for
apache
scores with a lot of patients are mostly close to the
prediction. Note that the size
, because it is based on one of
the variables, goes inside the aes
. If you wanted the
points all to be of size 5, say, you’d do it this way:
\(\blacksquare\)
26.20 Go away and don’t come back!
When a person has a heart attack and survives it, the major concern of health professionals is to prevent the person having a second heart attack. Two factors that are believed to be important are anger and anxiety; if a heart attack survivor tends to be angry or anxious, they are believed to put themselves at increased risk of a second heart attack.
Twenty heart attack survivors took part in a study. Each one was given
a test designed to assess their anxiety (a higher score on the test
indicates higher anxiety), and some of the survivors took an anger
management course.
The data are in
link; y
and
n
denote “yes” and “no” respectively. The columns denote
(i) whether or not the person had a second heart attack, (ii) whether
or not the person took the anger management class, (iii) the anxiety
score.
- Read in and display the data.
Solution
##
## ── Column specification ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## cols(
## second = col_character(),
## anger = col_character(),
## anxiety = col_double()
## )
## # A tibble: 20 x 3
## second anger anxiety
## <chr> <chr> <dbl>
## 1 y y 70
## 2 y y 80
## 3 y y 50
## 4 y n 60
## 5 y n 40
## 6 y n 65
## 7 y n 75
## 8 y n 80
## 9 y n 70
## 10 y n 60
## 11 n y 65
## 12 n y 50
## 13 n y 45
## 14 n y 35
## 15 n y 40
## 16 n y 50
## 17 n n 55
## 18 n n 45
## 19 n n 50
## 20 n n 60
The anxiety scores are numbers; the other two variables are “yes” and “no”, which makes perfect sense.
\(\blacksquare\)
- * Fit a logistic regression predicting whether or not a heart attack survivor has a second heart attack, as it depends on anxiety score and whether or not the person took the anger management class. Display the results.
Solution
This:
##
## Call:
## glm(formula = factor(second) ~ anger + anxiety, family = "binomial",
## data = ha)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.52106 -0.68746 0.00424 0.70625 1.88960
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -6.36347 3.21362 -1.980 0.0477 *
## angery -1.02411 1.17101 -0.875 0.3818
## anxiety 0.11904 0.05497 2.165 0.0304 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 27.726 on 19 degrees of freedom
## Residual deviance: 18.820 on 17 degrees of freedom
## AIC: 24.82
##
## Number of Fisher Scoring iterations: 4
There’s no need to worry about two-column responses here, because each
row of the data frame refers to only one person, and the response
variable second
is already a categorical variable with two
categories (that needs to be turned into a factor
for
glm
).
\(\blacksquare\)
- In the previous part, how can you tell that you were predicting the probability of having a second heart attack (as opposed to the probability of not having one)?
Solution
The levels of a factor are taken in alphabetical order, with
n
as the baseline, so we are predicting the probability
of the second one y
.
\(\blacksquare\)
- *
For the two possible values
y
andn
ofanger
and the anxiety scores 40, 50 and 60, make a data frame containing all six combinations, and use it to obtain predicted probabilities of a second heart attack. Display your predicted probabilities side by side with what they are predictions for.
Solution
This time, I give you the values I want the predictions for (as opposed to calculating something like quartiles from the data), so we might as well just type them in. Step 1 is to save them (my preference is under plural names):
Step 2 is to make a data frame of combinations using
crossing
. I’ll call mine new
:
## # A tibble: 6 x 2
## anxiety anger
## <dbl> <chr>
## 1 40 n
## 2 40 y
## 3 50 n
## 4 50 y
## 5 60 n
## 6 60 y
Step 3 is to do the predictions. Into predict
go (in order)
the fitted model, the new data frame that we just made, and something
to make the predictions be probabilities:
Step 4 is to put these next to the data frame we
created. cbind
is easiest, since we don’t know what kind of
thing p
might be, and bind_cols
is pickier:
## anxiety anger p
## 1 40 n 0.16774789
## 2 40 y 0.06749763
## 3 50 n 0.39861864
## 4 50 y 0.19226955
## 5 60 n 0.68551307
## 6 60 y 0.43908386
\(\blacksquare\)
- Use your predictions from the previous part to describe the
effect of changes in
anxiety
andanger
on the probability of a second heart attack.
Solution
The idea is to change one variable while leaving the other fixed. (This is the common refrain of “all else equal”.)
Pick a level of anger
, say n
(it doesn’t matter
which) and look at the effect of anxiety
. The probability
of a second heart attack increases sharply from 0.17 to 0.40 to
0.69. So an increased anxiety score is associated with an
increased probability of second heart attack (all else equal).
To assess the effect of taking the anger management course, pick
an anxiety
value, say 40, and compare the probabilities
for anger
n
and y
. For someone who has
not taken the anger management course, the probability is 0.17,
but for someone who has, it drops all the way to 0.07. (The
pattern is the same at the other anxiety scores.)
Extra: the reason it doesn’t matter what value of the other
variable you look at (as long as you keep it fixed) is that the
model is “additive” with no interaction, so that the effect of
one variable does not depend on the value of the other one. If we
wanted to see whether the effect of anxiety was different
according to whether or not the person had taken the anger
management course, we would add an interaction between
anxiety
and anger
. But we won’t be doing this
kind of thing until we get to analysis of variance, so you don’t
need to worry about it yet.
\(\blacksquare\)
- Are the effects you described in the previous part
consistent with the
summary
output fromglm
that you obtained in (here)? Explain briefly how they are, or are not. (You need an explanation for each ofanxiety
andanger
, and you will probably get confused if you look at the P-values, so don’t.)
Solution
In the previous part, we found that increased anxiety went with an
increased probability of second heart attack. Back in
(here), we found a positive slope of 0.11904 for anxiety,
which also means that a higher anxiety score goes with a higher
probability of second heart attack.
That was not too hard. The other one is a little more work.
anger
is categorical with two categories n
and
y
. The first one, n
, is the baseline, so
angery
shows how y
compares to n
. The
slope \(-1.04211\) is negative, which means that someone who has
taken the anger management course has a lower probability
of a second heart attack than someone who hasn’t (all else
equal). This is the same story that we got from the predictions.
That’s it for that, but I suppose I should talk about those
P-values.
anxiety
is significant, so it definitely has an effect on
the probability of a second heart attack. The pattern is clear
enough even with this small data set. Here’s a visual:
This is the wrong way around in terms of cause and effect, but it shows pretty clearly that people who suffer a second heart attack have a higher level of anxiety than those who don’t.
That’s clear enough, but what about anger
? That is not
significant, but there seems to be a visible effect of anger
on the predicted probabilities of (here): there we saw
that if you had done the anger management course, your probability of
a second heart attack was lower. But that’s only the predicted
probability, and there is also uncertainty about that, probably quite
a lot because we don’t have much data. So if we were to think about
confidence intervals for the predicted probabilities, they would be
wide, and for the two levels of anger
at a fixed
anxiety
they would almost certainly overlap.
Another way of seeing that is a visual, which would be a side-by-side bar chart:
A small majority of people who took the anger management did not have a second heart attack, while a small minority of those who did not, did.52 But with these small numbers, the difference, even though it points the way we would have guessed, is not large enough to be significant:
## second
## anger n y
## n 4 7
## y 6 3
This is not nearly far enough from an equal split to be significant. (It’s the same kind of idea as for Mood’s median test in C32/C33.)
\(\blacksquare\)
I get confused about the difference between morals and ethics. [This is a very short description of that difference:] (http://smallbusiness.chron.com/differences-between-ethical-issues-moral-issues-business-48134.html). The basic idea is that morals are part of who you are, derived from religion, philosophy etc. Ethics are how you act in a particular situation: that is, your morals, what you believe, inform your ethics, what you do. That’s why the students had to play the role of an ethics committee, rather than a morals committee; presumably the researcher had good morals, but an ethics committee had to evaluate what he was planning to do, rather than his character as a person.↩
As with many of these acronyms, you get the idea that the acronym came first and they devised some words to fit it.↩
My daughter learned the word pre-empt because we like to play a bridge app on my phone; in the game of bridge, you make a pre-emptive bid when you have no great strength but a lot of cards of one suit, say seven, and it won’t be too bad if that suit is trumps, no matter what your partner has. If you have a weakish hand with a lot of cards in one suit, your opponents are probably going to be able to bid and make something, so you pre-emptively bid first to try and make it difficult for them.↩
This kind of thing is sometimes called an inverse prediction.↩
The usual application of this is to combine a number with a vector. If you try to subtract a length-2 vector from a length-6 vector, R will repeat the shorter one three times and do the subtraction, but if you try to subtract a length-2 vector from a length-7 vector, where you’d have to repeat the shorter one a fractional number of times, R will do it, but you’ll get a warning, because this is probably not what you wanted. Try it and see.↩
The test is this way because it’s a generalized linear model rather than a regular regression.↩
When you have one observation per line, the predictions are of the second of the two levels of the response variable. When you make that two-column response, the predictions are of the probability of being in the first column. That’s what it is. As the young people say, don’t @ me.↩
When you have higher-order terms, you have to keep the lower-order ones as well: higher powers, or interactions (as we see in ANOVA later).↩
I get confused about the difference between morals and ethics. [This is a very short description of that difference:] (http://smallbusiness.chron.com/differences-between-ethical-issues-moral-issues-business-48134.html). The basic idea is that morals are part of who you are, derived from religion, philosophy etc. Ethics are how you act in a particular situation: that is, your morals, what you believe, inform your ethics, what you do. That’s why the students had to play the role of an ethics committee, rather than a morals committee; presumably the researcher had good morals, but an ethics committee had to evaluate what he was planning to do, rather than his character as a person.↩
Strictly, we should look at the difference in log-odds.↩
If you took STAB23, you’ll have used PSPP, which is a free version of SPSS.↩
If you’re selecting columns, you can use select-helpers, but for rows, not.↩
Which is loaded with the
tidyverse
so you don’t have to load it.↩The counts are in a column called
n
which we calculate and then ignore.↩As with many of these acronyms, you get the idea that the acronym came first and they devised some words to fit it.↩
By size is meant the area of the circle, which is what our brains perceive as the size of two-dimensional, like the area of a slice in a pie chart. On the plot, the radius of the circle for 20 is less than twice that of the circle for 10, because the area depends on the radius squared.↩
Read that carefully.↩


Money Play. How should Red play 53?
pips Red=140 White=180
(CorrectAnswer= 0/0, ErrorScore= 0)
This is a question of timing. At the moment White is forty pips behind in the race which is not enough to comfortably play a 1-3 back game.
Hitting can only play into his hands by correcting that timing and/or changing his back game points.
The simple 23/20, 13/8 is the right play by a long way. Every other play is a double blunder or worse.
Hitting can only play into his hands by correcting that timing and/or changing his back game points.
The simple 23/20, 13/8 is the right play by a long way. Every other play is a double blunder or worse.
1. Cubeful 2-ply 23/20 13/8 Eq.: +0.362 0.579 0.207 0.013 - 0.421 0.075 0.002 2. Cubeful 2-ply 23/18*/15 Eq.: +0.226 (-0.136) 0.531 0.231 0.023 - 0.469 0.100 0.003 3. Cubeful 0-ply 23/18* 13/10 Eq.: +0.173 (-0.189) 0.516 0.230 0.023 - 0.484 0.110 0.005 4. Cubeful 0-ply 23/15 Eq.: +0.116 (-0.246) 0.520 0.192 0.013 - 0.480 0.135 0.005 5. Cubeful 0-ply 20/15 13/10 Eq.: +0.043 (-0.319) 0.500 0.190 0.014 - 0.500 0.148 0.008


Client Details:
Identify a Target Audience
Get Online
Build Strong Relationships
Description:
Key responsibilities for the Admin Assistant
- Managing, designing, developing, creating and maintaining construction projects
- Conducting on-site investigetions and analyzing
- Assessing potential risks, materials and costs
- Carry out technical and feasibility studies and draw up blueprints that satisfy technical specifications
- Assess potential risks, materials and costs
- Provide advice and resolve creatively any emerging problems/deficiencies
- Manage budget and purchase equipment/materials
Requirements
The successful Admin Assistant
- Proven working experience in civil engineering
- Excellent knowledge of design and visualizations software such as AutoCAD,Civil 3D or similar
- Proficiency in site layout, grading, utility design, erosion control, regulatory approvals etc
- Project management and supervision skills
- Strong communication and interpersonal skills
- License of professional engineer


--- title: Welcome to the gamba library! keywords: fastai sidebar: home_sidebar summary: "A Python library for player behaviour tracking research" description: "A Python library for player behaviour tracking research" nb_path: "index.ipynb" ---
The gamba transaction analysis library is a collection of methods for applying analytical methods found in peer-reviewed studies. The library is 100% free and open source, and aims to be used by researchers and analysts with access to transaction data sets.
Getting started using gamba in your research is super easy - the first step is to install the library using one of the commands below. From there, read through one or more of the tutorials, and once you're familiar with the typical structure of an analysis using the gamba library, look through the individual module documentation and extend one of the examples. If you get stuck, please get in touch!
To install gamba use the following pip command;
pip install gamba
Or if you'd like to use the development release, clone the github repository to your machine;
git clone https://github.com/gamba-dev/gamba.git


Most enrolled and highly rated Programming courses
“All of my friends who have younger siblings who are going to college or high school - my number one piece of advice is: You should learn how to program.” - Mark Zuckerberg
© Copyright 2021 myClass


RESEARCH BAZAAR, 2018
Skills Sharing - Digital Literacy - Research Collaboration
Come Join Us
Locations
All Research Bazaar events respect our
Code of Conduct
.
Contact ResBaz


|
Conflux HDMI
0.0.2
Hardware abstraction layer for internal HDMI kits for original Xbox
|
This class is a singleton that contains the full developer-facing interface for developing applications that leverage some of the internal HDMI kits for original Xbox. Currently supported devices are indexed by Conflux::HdmiHardwareId. More...
#include <HdmiTools.h>
Public Member Functions | |
| bool | Initialize () |
| Initializes the singleton object. More... | |
| bool | IsFeatureSupported (SupportedFeatures feature) |
| Check feature support on the current platform. More... | |
| void | GetAllSupportedFeatures (std::vector< SupportedFeatures > *features) |
| Gets all configurable features supported by the installed HDMI hardware. More... | |
| const std::map< SupportedFeatures, RangedIntValue * > & | GetConstFeatureMap () |
| Gets a read only reference to the map of supported features and values. More... | |
| const char * | GetHdmiName () |
| Get the name of the installed HDMI device. More... | |
| VersionCode | GetFirmwareVersion () |
| Gets a VersionCode object filled out with the firmware version. More... | |
| VersionCode | GetKernelPatchVersion () |
| Gets a VersionCode object filled out with the kernel version. More... | |
| bool | IsUpdateAvailable (UpdateSource updateSource, const char *pathToFirmware="") |
| Checks to see if a firmware update is available via the provided update source. More... | |
| bool | UpdateFirmware (UpdateSource updateSource, void(*currentProcess)(const char *currentProcess), void(*percentComplete)(int percentageComplete), void(*errorMessage)(const char *errorMessage), void(*updateComplete)(bool flashSuccessful), const char *pathToFirmware=" ") |
| Calling this function with a valid update source will begin the process of updating the firmware. This is an async process and updates to the process are provided via callbacks. More... | |
| bool | GetFeatureValues (SupportedFeatures feature, int *value, int *min, int *max) |
| Get the current value of a given feature, as well as the valid value range. More... | |
| bool | SetFeatureValue (SupportedFeatures feature, int value) |
| Sets the current value of a configurable feature. More... | |
| bool | UpdateFeatureConfig () |
| Updates all feature values in the hardware configuration of the HDMI hardware. More... | |
| const char * | GetFeatureName (SupportedFeatures feature) |
| Gets the name of the feature requested. More... | |
| bool | SaveSettings () |
| Save all configurable features. More... | |
Static Public Member Functions | |
| static HdmiTools * | GetInstance () |
| Get the singleton Instance object. More... | |
This class is a singleton that contains the full developer-facing interface for developing applications that leverage some of the internal HDMI kits for original Xbox. Currently supported devices are indexed by Conflux::HdmiHardwareId.
Definition at line 40 of file HdmiTools.h.
| void Conflux::HdmiTools::GetAllSupportedFeatures | ( | std::vector< SupportedFeatures > * | features | ) |
Gets all configurable features supported by the installed HDMI hardware.
| features | enumeration of possible supported features. Indexed by Conflux::SupportedFeatures. |
Definition at line 115 of file HdmiTools.cpp.
| const std::map< SupportedFeatures, RangedIntValue * > & Conflux::HdmiTools::GetConstFeatureMap | ( | ) |
Gets a read only reference to the map of supported features and values.
Definition at line 126 of file HdmiTools.cpp.
| const char * Conflux::HdmiTools::GetFeatureName | ( | SupportedFeatures | feature | ) |
Gets the name of the feature requested.
| feature | enumeration of possible supported features. Indexed by Conflux::SupportedFeatures. |
Definition at line 264 of file HdmiTools.cpp.
| bool Conflux::HdmiTools::GetFeatureValues | ( | SupportedFeatures | feature, |
| int * | value, | ||
| int * | min, | ||
| int * | max | ||
| ) |
Get the current value of a given feature, as well as the valid value range.
| feature | enumeration of possible supported features. Indexed by Conflux::SupportedFeatures. |
| value | current value of this configurable feature. |
| min | minimum valid range of this configurable feature. |
| max | maximum valid range of this configurable feature. |
Definition at line 221 of file HdmiTools.cpp.
| VersionCode Conflux::HdmiTools::GetFirmwareVersion | ( | ) |
Gets a VersionCode object filled out with the firmware version.
Definition at line 145 of file HdmiTools.cpp.
| const char * Conflux::HdmiTools::GetHdmiName | ( | ) |
Get the name of the installed HDMI device.
Definition at line 135 of file HdmiTools.cpp.
|
static |
Get the singleton Instance object.
Definition at line 70 of file HdmiTools.cpp.
| VersionCode Conflux::HdmiTools::GetKernelPatchVersion | ( | ) |
Gets a VersionCode object filled out with the kernel version.
Definition at line 164 of file HdmiTools.cpp.
| bool Conflux::HdmiTools::Initialize | ( | ) |
Initializes the singleton object.
Definition at line 80 of file HdmiTools.cpp.
| bool Conflux::HdmiTools::IsFeatureSupported | ( | SupportedFeatures | feature | ) |
Check feature support on the current platform.
| feature | enumeration of possible supported features. Indexed by Conflux::SupportedFeatures. |
Definition at line 106 of file HdmiTools.cpp.
| bool Conflux::HdmiTools::IsUpdateAvailable | ( | UpdateSource | updateSource, |
| const char * | pathToFirmware = "" |
||
| ) |
Checks to see if a firmware update is available via the provided update source.
| updateSource | Enumeration of possible update sources. Indexed by Conflux::UpdateSource. |
| pathToFirmware | Allows the location of the update to be provided by absolute path, if the update source is Conflux::UpdateSource::WORKING_DIRECTORY. |
Definition at line 182 of file HdmiTools.cpp.
| bool Conflux::HdmiTools::SaveSettings | ( | ) |
Save all configurable features.
Definition at line 212 of file HdmiTools.cpp.
| bool Conflux::HdmiTools::SetFeatureValue | ( | SupportedFeatures | feature, |
| int | value | ||
| ) |
Sets the current value of a configurable feature.
| feature | enumeration of possible supported features. Indexed by Conflux::SupportedFeatures. |
| value | current value of this configurable feature. |
Definition at line 243 of file HdmiTools.cpp.
| bool Conflux::HdmiTools::UpdateFeatureConfig | ( | ) |
Updates all feature values in the hardware configuration of the HDMI hardware.
Definition at line 255 of file HdmiTools.cpp.
| bool Conflux::HdmiTools::UpdateFirmware | ( | UpdateSource | updateSource, |
| void(*)(const char *currentProcess) | currentProcess, | ||
| void(*)(int percentageComplete) | percentComplete, | ||
| void(*)(const char *errorMessage) | errorMessage, | ||
| void(*)(bool flashSuccessful) | updateComplete, | ||
| const char * | pathToFirmware = " " |
||
| ) |
Calling this function with a valid update source will begin the process of updating the firmware. This is an async process and updates to the process are provided via callbacks.
| updateSource | Enumeration of possible update sources. Indexed by Conflux::UpdateSource. |
| currentProcess | Callback that provides updates on the current update process. |
| percentComplete | Callback that provides the current percentage complete. |
| errorMessage | Callback that provides any errors encountered during the process. |
| updateComplete | Callback that notifies that the update has completed successfully, or otherwise. |
| pathToFirmware | Allows the location of the update to be provided by absolute path, if the update source is Conflux::UpdateSource::WORKING_DIRECTORY. |
Definition at line 194 of file HdmiTools.cpp.


The Golden age of comics started in 1938 when the first comic book with completely original material was published. Action Comics #1, written by Jerry Siegel and Joe Shuster, featured the first appearance of Superman.
Superman achieved instant commercial success. America has always been a nation of immigrants. Superman's status as the ultimate immigrant, the last member of an alien species seeking refuge on Earth, had mass appeal to America's immigrant population.
World War II also spurred the development of comic books. A large cast of super human character sprouted up to fight the Nazi menace throughout the late 30's and 40's.
Comic books have been a prominent form of American media since the late 1930's. The evolution of comic art and content provides a unique perspective on American culture.
The golden age of comics came to an end along with World War II. Once the Nazis had been defeated using super human powers to combat more ordinary problems seemed like overkill.
Comic books have been a prominent form of American media since the late 1930's. The evolution of comic art and content provides a unique perspective on American culture.
The Comic industry had a resurgence in 1956, with the creation of the Fantastic Four. They had real problems. They had issues with money, they fought amongst each other, and they had real emotional problems. The Silver age began to display many superheroes that had real defects.
Comic books have been a prominent form of American media since the late 1930's. The evolution of comic art and content provides a unique perspective on American culture.
Comic Books in the Silver age even started moving against mainstream ideological values. They began to question the motives behind the Vietnam War. There was even a fictionalization of the Water Gate Scandal in a Captain America story arc.
Comic books have been a prominent form of American media since the late 1930's. The evolution of comic art and content provides a unique perspective on American culture.
The 1970's started the bronze age of comics, which advanced comics even more as a medium with the creation of stories, which examined drug abuse, pollution, poverty, and racism.
Comic books have been a prominent form of American media since the late 1930's. The evolution of comic art and content provides a unique perspective on American culture.
The 1980's brought the modern age of comics. Books such as Watchmen brought critical acclaim to the world of comics by deconstructing the genre, and elevating the standing at which comics were held by society.
Comic books have been a prominent form of American media since the late 1930's. The evolution of comic art and content provides a unique perspective on American culture.
The massive increase in popularity comics have received from television and movie success in the modern age has brought comics into the mainstream.


## [Jitter Camera (Anti-Aliasing)](vkrt_tuto_jitter_cam.md.html)
Anti-aliases the image by accumulating small variations of rays over time.
* Random ray direction generation
* Read/write/accumulate final image
![Antialising](Images/antialiasing.png height= "300px")
## [Handle Thousands of Objects](vkrt_tuto_instances.md.html)
The current example allocates memory for each object, each of which has several buffers.
This shows how to get around Vulkan's limits on the total number of memory allocations by using a memory allocator.
* Extending the limit of 4096 memory allocations
* Using the Device Memory Allocator and Vulkan Memory Allocator
![20000 'unique' objects](Images/VkInstances.png height= "300px")
## [Any Hit Shader (Transparency)](vkrt_tuto_anyhit.md.html)
Implements transparent materials by adding a new shader to the Hit group and using the material
information to discard hits over time.
* Adding any hit (.ahit) to the ray tracing pipeline
* Making intersections randomly hit or not, which produces simple transparency
![One use of any hit shaders](Images/anyhit.png height= "300px")
## [Reflections](vkrt_tuto_reflection.md.html)
Reflections can be implemented by shooting new rays from the closest hit shader, or by iteratively shooting them from
the raygen shader. This example shows the limitations and differences of these implementations.
* Calling traceNV() from the closest hit shader (recursive)
* Adding more data to the ray payload to continue the ray from the raygen shader.
![Hundreds of Reflections](Images/reflections.png height= "300px")
## [Multiple Closest Hits Shader and Shader Records](vkrt_tuto_manyhits.md.html)
Explains how to add more closest hit shaders, choose which instance uses which shader, and add data per SBT that can be
retrieved in the shader, and more.
* One closest hit shader per object
* Sharing closest hit shaders for some object
* Passing shader record to closest hit shader
![Different Closest Hit and Shader Record](Images/manyhits.png height= "300px")
## [Animation](vkrt_tuto_animation.md.html)
This tutorial shows how animating the transformation matrices of the instances (TLAS)
and animating the vertices of an object (BLAS) in a compute shader could be done.
* Refit of top level acceleration structure
* Refit of bottom level acceleration structure
![TLAS and BLAS Animation](Images/animation2.gif height= "300px")
## [Intersection Shader](vkrt_tuto_intersection.md.html)
Adding thousands of implicit primitives and using an intersection shader to render spheres and cubes. The tutorial
explains what is needed to get procedural hit groups working.
* Intersection shader
* Sphere intersection
* Axis aligned bounding box intersection
![Intersection Shader with Spheres and Cubes](Images/ray_tracing_intersection.png height= "300px")
## [Callable Shader](vkrt_tuto_callable.md.html)
Replacing branching by callable shaders. The code to execute the lighting is done in separate callable shaders instead of being part of the main code.
* Adding multiple callable shaders
* Calling ExecuteCallableNV from the closest hit shader
![Infinite | Spot | Point lights from callable shaders](Images/callable.png height= "300px")


This is page 2
Go to Lesson 2
This is H1
This is H2
This is H3
This is bold
This is underline
This is italic
This is test and its goodewuihdfweiuhdwdehje


Our courses are provided by the best programmers with long experience
Each course includes many exercises after each lesson and a project after each section
Our prices are carefully set to suit the students' financial capabilities
Our site offers monthly offers and discounts on courses
Web-developer +10 years of experience
Web-developer +10 years of experience
Web-developer +15 years of experience
Web-developer +13 years of experience
A new section has been added to the site specialized in everything new in the world of programming It includes updates, new programming languages, and the latest technologies. Register your information to get notifications about all news.
Google Flutter, The Complete 2021 Flutter Development Bootcamp with Dart Officially created in collaboration with the Google Flutter team. Build beautiful native apps for iOS and Android with this one-stop guide on Dart & Flutter Framework.
Discounts of up to 50% in the case of purchasing 2 courses or more.
The offer is valid from 12/8 to 18/8
Offer is valid on all of our courses
Do not miss the chance!
We are looking for a skilled web developer who will be responsible for developing and/or designing websites for our company. You will be working alongside a team of other developers in creating, maintaining, and updating our websites.
The Ultimate Git Mastery Course
you will learn everything You Need to Use Git & GitHub Like a Professional.
It includes all the key concepts of Git, Branching & merging
,Handling conflicts, and more.
Join our programmers platform now and stay informed of the latest developments And the latest technology in the world of programming. Hurry up to join to gain from the experience of our programmers.


47+ Gucci Supremelis Logo Tights Gif. Enjoy free shipping, returns & complimentary gift wrapping. Shop women's socks & tights, including hosiery and knee high styles at gucci.com.
Gucci supremelis interlocking gg tights. Only authentic & brand new. Shop our selection of supreme today!
Buy and sell authentic gucci supreme lace up gg shoes 355663 khn80 9860 and thousands of other gucci sneakers with price data and release dates.
Tonal logo knit at elasticized waistband. At logolynx.com find thousands of logos free shipping and returns on gucci supreme logo tights at nordstrom.com. Brand new never opened gucci logo tights from the gucci store. Did you scroll all this way to get facts about gucci tights?


Japan econmin says he hopes Britain joins TPP trade pact after Brexit
by ReutersTOKYO — Japanese Economy Minister Yasutoshi Nishimura said on Wednesday that he hoped Britain would join the Trans-Pacific Partnership (TPP), an 11-member free trade agreement, after it leaves the European Union.
Nishimura told reporters at the Japan National Press Club that negotiations about Britain’s entry into the free trade bloc can’t really take place as long as it remains an EU member.
He also said he hoped Japan’s economic relations with Britain remain strong after Brexit. (Reporting by Daniel Leussink; Editing by Chang-Ran Kim)


The red blocks are trained to hunt the green blocks. The green blocks are trained to hide from the red blocks. Wait for the first collision to see them learn.


{% extends 'wallets/base.html' %} {% block content %} {% load static %}
{{ address }}
Balance: {{ address.balance }}
Go to address


4 April 2005
As of 2 April, the Ministry of Health, Angola has reported 163 cases of Marburg haemorrhagic fever. Of these, 150 have been fatal. Cases have been identified in Uige, Luanda, Cabinda, Malange, and Kuanza Norte provinces. Uige remains the epicentre of the outbreak. To date, all cases detected in other provinces are thought to have originated in Uige.
Five mobile surveillance teams in Uige continue to investigate rumours and search for additional cases.
WHO is working with the Ministry of Health to finalize a national plan of action for control of the outbreak, including sustained technical and operational support from WHO and international partners in GOARN. WHO anticipates that implementation of this plan will require significant assistance from the international community.


Government response
Department for Education response to the publication of our consolidated annual report and accounts.
Responding to the publication of the accounts, a department spokesperson said:
We are pleased the NAO has found no material inaccuracies in the financial statements of the department, the EFA and the 3,905 academies included in this report.
However, consolidating the accounts of thousands of academies is an enormous task. This is a complex procedure and the largest of its kind carried out in the UK, and involves the consolidation of accounts with different year ends. We recognise the issues identified by the NAO with this process. We take the concerns very seriously.
We are working closely with the HM Treasury to find a more sustainable solution to this process.
The Comptroller and Auditor General has acknowledged improvements we are already making to the accounts process, including:
The department’s financial year ended on 31 March 2014, while academies produce their accounts for the academic year, which ended on 31 August 2013. Consolidating accounts from these 2 different time periods is a significant contributory factor to the level of error and uncertainty in the accounts.
Read the ‘ DfE consolidated annual report and accounts: 2013 to 2014 ’.
Published: 20 January 2015


--- layout: page category: spec title: "Web Payments HTTP Messages 1.0" ---
| Current Status: | Working Draft (WD) |
|---|---|
| Canonical URI: |
http://www.w3.org/TR/webpayments-http-messages
|
| Abstract: | This document specifies the Web Payments messages that are used to initiate and acknowledge a payment request via the HTTP protocol. The messages are typically passed between the software ecosystem that initiates, executes, and finalizes Web Payments. |
Web Payments HTTP Messages 1.0Updates:


For your website or blog visitors. Edit "wallet" in /scripts/croat.js
v0.2 Non-mobile
21/07/2019
- Disable CSS & javascript on mobile devices
v0.1 First version
20/07/2019
- localStorage key (minerName) with value "WebMiner-" + timestamp. This is to keep a custom minername in your pool
- localStorage key (minerEnd) with current timestamp plus 10 minutes. This is to keep miner working during 10 minutes, even if you change current page.
- localStorage key (minerAd) with current timestamp plus 10 minutes. This is to keep modal windows AD hidden during 10 minutes if you have already accepted or closed modal
Script check each time is there is (minerName) and (minerEnd).