Modeling Global Life Expectancy vs Education using Least Squares Regression
Updated:
Motivation
I realize that it’s not 1774, and that no serious data person spends any amount of time thinking about ordinary least squares regression. Even calling it “ordinary” implies that it’s mundane and uninteresting.
But honestly, when I first learned the mechanics of OLS in an intro stats class, I found it incredibly insightful. It blew my mind that there is so much data being collected and analyzed by super powerful computers and being passed into fancy machine learning models that can literally predict the future. And yet, when you really dig down and get to the fundamentals, all of it came from simple equations for distances between points.
In this post, we’ll explore the mechanics of ordinary least squares regression using global data on life expectancy collected by the World Health Organization. We’ll get down to some bare-bones concepts of regression modeling, analyze model diagnostics, compare two models, and attempt to validate the assumptions for performing linear regression in the first place.
Data Preparation
Data Source
We’ll be using the WHO’s life expectancy dataset, found on Kaggle here.
Libraries
knitr::opts_chunk$set(echo = TRUE, warning = FALSE, message = FALSE)
library(tidyverse)
library(skimr)
library(broom)
theme_set(theme_bw())
Data Import and Tidy
Reading in and having a quick look at the dataset:
lifexp_df = read.csv(file = "../data/regression/who_life_expectancy.csv") %>%
janitor::clean_names()
glimpse(lifexp_df)
## Rows: 2,938
## Columns: 22
## $ country <fct> Afghanistan, Afghanistan, Afghanistan, Afghani…
## $ year <int> 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008…
## $ status <fct> Developing, Developing, Developing, Developing…
## $ life_expectancy <dbl> 65.0, 59.9, 59.9, 59.5, 59.2, 58.8, 58.6, 58.1…
## $ adult_mortality <int> 263, 271, 268, 272, 275, 279, 281, 287, 295, 2…
## $ infant_deaths <int> 62, 64, 66, 69, 71, 74, 77, 80, 82, 84, 85, 87…
## $ alcohol <dbl> 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.03…
## $ percentage_expenditure <dbl> 71.279624, 73.523582, 73.219243, 78.184215, 7.…
## $ hepatitis_b <int> 65, 62, 64, 67, 68, 66, 63, 64, 63, 64, 66, 67…
## $ measles <int> 1154, 492, 430, 2787, 3013, 1989, 2861, 1599, …
## $ bmi <dbl> 19.1, 18.6, 18.1, 17.6, 17.2, 16.7, 16.2, 15.7…
## $ under_five_deaths <int> 83, 86, 89, 93, 97, 102, 106, 110, 113, 116, 1…
## $ polio <int> 6, 58, 62, 67, 68, 66, 63, 64, 63, 58, 58, 5, …
## $ total_expenditure <dbl> 8.16, 8.18, 8.13, 8.52, 7.87, 9.20, 9.42, 8.33…
## $ diphtheria <int> 65, 62, 64, 67, 68, 66, 63, 64, 63, 58, 58, 5,…
## $ hiv_aids <dbl> 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0…
## $ gdp <dbl> 584.25921, 612.69651, 631.74498, 669.95900, 63…
## $ population <dbl> 33736494, 327582, 31731688, 3696958, 2978599, …
## $ thinness_1_19_years <dbl> 17.2, 17.5, 17.7, 17.9, 18.2, 18.4, 18.6, 18.8…
## $ thinness_5_9_years <dbl> 17.3, 17.5, 17.7, 18.0, 18.2, 18.4, 18.7, 18.9…
## $ income_composition_of_resources <dbl> 0.479, 0.476, 0.470, 0.463, 0.454, 0.448, 0.43…
## $ schooling <dbl> 10.1, 10.0, 9.9, 9.8, 9.5, 9.2, 8.9, 8.7, 8.4,…
skim(lifexp_df)
Table: Data summary
| Name | lifexp_df |
| Number of rows | 2938 |
| Number of columns | 22 |
| ___________ | |
| Column type frequency: | |
| factor | 2 |
| numeric | 20 |
| ________ | |
| Group variables | None |
Variable type: factor
| skim_variable | n_missing | complete_rate | ordered | n_unique | top_counts |
|---|---|---|---|---|---|
| country | 0 | 1 | FALSE | 193 | Afg: 16, Alb: 16, Alg: 16, Ang: 16 |
| status | 0 | 1 | FALSE | 2 | Dev: 2426, Dev: 512 |
Variable type: numeric
| skim_variable | n_missing | complete_rate | mean | sd | p0 | p25 | p50 | p75 | p100 | hist |
|---|---|---|---|---|---|---|---|---|---|---|
| year | 0 | 1.00 | 2007.52 | 4.61 | 2000.00 | 2004.00 | 2008.00 | 2012.00 | 2.015000e+03 | ▇▆▆▆▆ |
| life_expectancy | 10 | 1.00 | 69.22 | 9.52 | 36.30 | 63.10 | 72.10 | 75.70 | 8.900000e+01 | ▁▂▃▇▂ |
| adult_mortality | 10 | 1.00 | 164.80 | 124.29 | 1.00 | 74.00 | 144.00 | 228.00 | 7.230000e+02 | ▇▆▂▁▁ |
| infant_deaths | 0 | 1.00 | 30.30 | 117.93 | 0.00 | 0.00 | 3.00 | 22.00 | 1.800000e+03 | ▇▁▁▁▁ |
| alcohol | 194 | 0.93 | 4.60 | 4.05 | 0.01 | 0.88 | 3.75 | 7.70 | 1.787000e+01 | ▇▃▃▂▁ |
| percentage_expenditure | 0 | 1.00 | 738.25 | 1987.91 | 0.00 | 4.69 | 64.91 | 441.53 | 1.947991e+04 | ▇▁▁▁▁ |
| hepatitis_b | 553 | 0.81 | 80.94 | 25.07 | 1.00 | 77.00 | 92.00 | 97.00 | 9.900000e+01 | ▁▁▁▂▇ |
| measles | 0 | 1.00 | 2419.59 | 11467.27 | 0.00 | 0.00 | 17.00 | 360.25 | 2.121830e+05 | ▇▁▁▁▁ |
| bmi | 34 | 0.99 | 38.32 | 20.04 | 1.00 | 19.30 | 43.50 | 56.20 | 8.730000e+01 | ▅▅▅▇▁ |
| under_five_deaths | 0 | 1.00 | 42.04 | 160.45 | 0.00 | 0.00 | 4.00 | 28.00 | 2.500000e+03 | ▇▁▁▁▁ |
| polio | 19 | 0.99 | 82.55 | 23.43 | 3.00 | 78.00 | 93.00 | 97.00 | 9.900000e+01 | ▁▁▁▂▇ |
| total_expenditure | 226 | 0.92 | 5.94 | 2.50 | 0.37 | 4.26 | 5.75 | 7.49 | 1.760000e+01 | ▃▇▃▁▁ |
| diphtheria | 19 | 0.99 | 82.32 | 23.72 | 2.00 | 78.00 | 93.00 | 97.00 | 9.900000e+01 | ▁▁▁▂▇ |
| hiv_aids | 0 | 1.00 | 1.74 | 5.08 | 0.10 | 0.10 | 0.10 | 0.80 | 5.060000e+01 | ▇▁▁▁▁ |
| gdp | 448 | 0.85 | 7483.16 | 14270.17 | 1.68 | 463.94 | 1766.95 | 5910.81 | 1.191727e+05 | ▇▁▁▁▁ |
| population | 652 | 0.78 | 12753375.12 | 61012096.51 | 34.00 | 195793.25 | 1386542.00 | 7420359.00 | 1.293859e+09 | ▇▁▁▁▁ |
| thinness_1_19_years | 34 | 0.99 | 4.84 | 4.42 | 0.10 | 1.60 | 3.30 | 7.20 | 2.770000e+01 | ▇▃▁▁▁ |
| thinness_5_9_years | 34 | 0.99 | 4.87 | 4.51 | 0.10 | 1.50 | 3.30 | 7.20 | 2.860000e+01 | ▇▃▁▁▁ |
| income_composition_of_resources | 167 | 0.94 | 0.63 | 0.21 | 0.00 | 0.49 | 0.68 | 0.78 | 9.500000e-01 | ▁▁▅▇▆ |
| schooling | 163 | 0.94 | 11.99 | 3.36 | 0.00 | 10.10 | 12.30 | 14.30 | 2.070000e+01 | ▁▂▇▇▁ |
The dataset contains 2938 rows, spanning 22 variables. Every row represents a country and year combination - a total of 193 unique countries for every year from 2000 to 2015. We’ll limit the analysis to one year since having the same country repeated as a new row constitutes a repeated measure, which requires more sophisticated analysis than what we’re doing here. I’m going to (arbitrarily) choose 2012.
We also notice from the glimpse()
output that we have quite a few missing values, so we’ll need to drop them from our analysis. Of the 22 variables available, we’re really only going to focus on the following variables:
life_expectancy
: average life expectancy at birth, measured in yearsschooling
: national average of years of formal educationstatus
: binary variable coded “Developed” or “Developing” (this will allow for some interesting stratification later on)
We will ignore the other variables for this analysis. Thus, our final dataset is as follows:
final_df =
lifexp_df %>%
filter(year == "2012") %>%
drop_na(life_expectancy, schooling, status)
Analysis
Step 1: Fit and Interpret Model(s)
Ordinary Least Squares Regression - Single Variable
To visualize the math behind OLS, let’s take a look at a scatterplot of life expectancy vs schooling.
final_df %>%
ggplot(aes(x = schooling, y = life_expectancy)) +
geom_point() +
labs(
title = "Figure 1: Life Expectancy vs Schooling"
)
We have a pretty linear relationship with potentially some heteroscedasticity, which we’ll talk about in the assumptions section below. We’re going to ask R to fit a line through these data points and then we’ll break down how R came up with this line.
model_1 =
lm(data = final_df, life_expectancy ~ schooling)
summary(model_1)
##
## Call:
## lm(formula = life_expectancy ~ schooling, data = final_df)
##
## Residuals:
## Min 1Q Median 3Q Max
## -14.8459 -2.5066 0.3488 3.2111 12.4766
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 41.8211 1.7213 24.30 <2e-16 ***
## schooling 2.2932 0.1319 17.38 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5.003 on 171 degrees of freedom
## Multiple R-squared: 0.6386, Adjusted R-squared: 0.6365
## F-statistic: 302.1 on 1 and 171 DF, p-value: < 2.2e-16
The coefficients, also known as the beta terms, are our regression parameters: the intercept, \(b_0\), estimated as 41.821 years, represents the average life expectancy in a theoretical nation where the average years of schooling was 0. This value is meaningless because there are no nations with this average education level and to interpret a regression line beyond the scope of the data that generated it is an epic no-no of cardinal sin magnitude. The slope, \(b_1 \), is estimated as 2.293, and represents the rate of change in life expectancy per additional year of schooling, give or take an error term, \(\epsilon_i \). So on average, countries with one additional year of schooling add 2.293 years their average life expectancy.
Thus, from the “true” population model: \[y_i = \beta_0 + \beta_1*x_i + \epsilon_i \]
we get our fitted model: \[y = 41.821 + 2.293*x \]
Note that the F-statistic has a very small p-value (F = 302.1 on 1 and 171 DF, p-value: < 2.2e-16). This means that our model is statistically significant. But since we only have one predictor term, the statistical significance of the model is same as the significance of the schooling
predictor.
To visualize the line, we use geom_smooth
with a method = “lm” argument:
final_df %>%
ggplot(aes(x = schooling, y = life_expectancy)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
labs(
title = "Figure 2: Fitted Model"
)
We want to look closely at the distances between the datapoints and the line. Unfortunately, lm()
doesn’t give us a dataframe output we can work with. This is where the broom
package comes in handy. Specifically, the augment()
function within broom
allows us to build a dataframe with all kinds of useful information:
model_1_df =
broom::augment(model_1)
model_1_df
## # A tibble: 173 x 9
## life_expectancy schooling .fitted .se.fit .resid .hat .sigma .cooksd .std.resid
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 59.5 9.8 64.3 0.542 -4.79 0.0117 5.00 0.00551 -0.964
## 2 76.9 14.2 74.4 0.427 2.52 0.00729 5.01 0.000936 0.505
## 3 75.1 14.4 74.8 0.440 0.257 0.00773 5.02 0.0000104 0.0516
## 4 56 10.3 65.4 0.497 -9.44 0.00987 4.96 0.0179 -1.90
## 5 75.9 13.8 73.5 0.406 2.43 0.00658 5.01 0.000789 0.488
## 6 75.9 17.2 81.3 0.702 -5.36 0.0197 5.00 0.0118 -1.08
## 7 74.4 12.7 70.9 0.380 3.46 0.00578 5.01 0.00139 0.693
## 8 82.3 20.1 87.9 1.04 -5.61 0.0436 5.00 0.0300 -1.15
## 9 88 15.7 77.8 0.547 10.2 0.0119 4.96 0.0253 2.05
## 10 71.9 11.8 68.9 0.399 3.02 0.00637 5.01 0.00118 0.605
## # … with 163 more rows
The critical column here is the residuals vector, .resid
, i.e. the vertical distances between the observed points and the fitted line. These values form the basis of regression modeling. To formalize, the residual (also known as the error term) is given as:
\[ \epsilon_i = Y_i - \hat{Y_i} \]
where the little hat on the Y indicates that it’s the model estimate, meaning the y-value of the point on the blue line.
If we were to look at just the data points, close one eye, and draw a line through them, we’d probably come with something close to the blue line R gave us. But while we would be using the complex machinery of our brain’s pattern-recognition capacity, the actual math behind the blue line is fairly straightforward. It all comes down to finding a line that optimizes these residuals. In fact, when we say “least squares”, we’re referring to minimizing the squares of these values. Let’s visualize them here using geom_segment()
:
model_1_df %>%
ggplot(aes(x = schooling, y = life_expectancy)) +
geom_point() +
geom_segment(aes(xend = schooling, yend = .fitted), color = "red") +
geom_smooth(method = "lm", se = FALSE) +
labs(
title = "Figure 3: Model Residuals"
)
The red lines are the residuals and the way R computes the fitted model is by minimizing the squares of these red lines. The residuals are squared to avoid cancellation when adding positive and negative values.
OLS - Multi-variable Modeling
In the real world, we’re hardly ever working with just one predictor. The beauty of regression modeling lies in its flexibility - we can add as many predictors to the right side of the equation as we want, and they don’t need to be continuous variables. We can add categorical predictors using “dummy variables” (explained here). There is of course a trade-off in flexibility if you add tons of predictors, and generally speaking, you should only add predictors that make theoretical sense and keep your model parsimonious.
It should also be clear that when you add a second predictor, you’re no longer working in two-dimensional space. You need a third dimension to describe the relationship between the dependent and independent variables. You will also no longer be fitting a regression line, but a regression plane, which is very cool. We won’t make a plane here, but you can find an example here.
Let’s take a look at our third variable, status
, indicating whether the observation (nation) is considered developed or developing by the WHO’s definition. First, let’s do some visualization:
final_df %>%
mutate(index = row_number()) %>%
ggplot(aes(x = index, y = life_expectancy, group = status)) +
geom_point(aes(color = status)) +
labs(
title = "Figure 4: Life Expectancy Difference by Status "
)
Clearly, countries in the developed world have higher life expectancy. But the question we want to answer is whether the relationship between schooling and life expectancy changes between developed and developing countries. In other words, if we fit a line using just the green points, and another using just the red points, would the slopes of those lines be different? And if so, how different? Regression modeling gives us an easy way to find out - all we need to do is add status
as a predictor term:
model_2 =
lm(data = final_df, life_expectancy ~ schooling + status)
summary(model_2)
##
## Call:
## lm(formula = life_expectancy ~ schooling + status, data = final_df)
##
## Residuals:
## Min 1Q Median 3Q Max
## -14.7545 -3.1520 0.5462 3.5773 12.4017
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 45.4937 2.7312 16.657 <2e-16 ***
## schooling 2.1420 0.1578 13.578 <2e-16 ***
## statusDeveloping -2.1010 1.2176 -1.725 0.0863 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.975 on 170 degrees of freedom
## Multiple R-squared: 0.6448, Adjusted R-squared: 0.6406
## F-statistic: 154.3 on 2 and 170 DF, p-value: < 2.2e-16
Again, the p-value on our F-statistic is significant, meaning that there is a statistically significant relationship between the outcome and the combination of predictors.
Our new model statement is: \[y = 45.4937 + 2.142schooling - 2.101status \]
The coefficient of the status
variable indicates that, on average, after we control for schooling, there is a difference in life expectancy of 2.1 years between developing and developed countries. However, note that the p-value for the status predictor is 0.08 (p > 0.05), meaning that controlling for education, status is not a significant predictor of life expectancy. This does not mean that status alone is not a significant predictor of life expectancy. It just means that after we control for education by putting it in the model, the effect of status mostly washes away.
To illustrate:
model_3 = lm(data = final_df, life_expectancy ~ status)
summary(model_3)
##
## Call:
## lm(formula = life_expectancy ~ status, data = final_df)
##
## Residuals:
## Min 1Q Median 3Q Max
## -19.408 -5.408 1.307 5.592 14.892
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 80.393 1.330 60.456 < 2e-16 ***
## statusDeveloping -11.285 1.458 -7.742 8.17e-13 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7.161 on 171 degrees of freedom
## Multiple R-squared: 0.2596, Adjusted R-squared: 0.2552
## F-statistic: 59.94 on 1 and 171 DF, p-value: 8.169e-13
Clearly, status is a highly significant factor in life expectancy when considered by itself. This is even clearer in a plot:
final_df %>%
ggplot(aes(x = status, y = life_expectancy)) +
geom_point() +
stat_smooth(method = "lm", se = FALSE) +
labs(
title = "Figure 5: Status vs Life Expectancy"
)
What the p-value for status in model_2
does tell us is that the relationship between schooling and life expectancy does not change significantly between developed and developing countries.
Again, to visualize:
final_df %>%
ggplot(aes(x = schooling, y = life_expectancy, group = status)) +
geom_point(aes(color = status)) +
labs(
title = "Figure 6: Schooling vs Life Expectancy by Status"
)
The point is that even though we have two distinct clusters, the regression line is more or less the same between them.
For our purposes, we’re going to take all of this to mean that we should get rid of the status
term in our model. This is not to say that all predictors with p-values < 0.05 don’t belong in your model. We’re not going to go down that rabbit hole, but you can find people arguing the matter at length on stackexchange. This is just a decision I’m making based on the evidence.
So now that we’ve settled on model_1
, how do we figure out how “good” it is? That’s where regression diagnostics come in.
Step 2: Figure out how “good” your model is
Smith et al (2017) describe regression diagnostics as an art, referring to the absence of a structured process for model evaluation. After looking through a digital bushel of papers, I would have to agree. If you spend any time looking at scientific work employing linear regression models, you’ll be hard-pressed to find any consistency in the measures scientists use to evaluate their models (if they use such measures at all).
However, it’s clear that simply fitting a linear model is not enough. While there are many different constructs and measures to evaluate model performance, I would like to, at minimum, understand the magnitude of a model’s error, its predictive capacity, the impact of outliers and influential observations, and whether it meets the assumptions for linear modeling in the first place. We’ll look at this last topic in the next section
First, let’s look at perhaps the most common model diagnostic, \(R^2\), or, more formally, the coefficient of determination. For a single-variable model, \(R^2\), is just the square of our friend, the Pearson correlation coefficient. It turns out that this is actually a much more useful quantity:
\[ R^2 = \frac {\Sigma_{i=1}^n (y_i - \hat y_i)^2} {\Sigma_{i=1}^n (y_i - \bar y_i)^2} \]
\( R^2 \) is powerful because it’s completely intuitive - it equals the percentage of variance in the outcome explained by the predictor(s). This is part of the summary()
output:
summary(model_1)
##
## Call:
## lm(formula = life_expectancy ~ schooling, data = final_df)
##
## Residuals:
## Min 1Q Median 3Q Max
## -14.8459 -2.5066 0.3488 3.2111 12.4766
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 41.8211 1.7213 24.30 <2e-16 ***
## schooling 2.2932 0.1319 17.38 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5.003 on 171 degrees of freedom
## Multiple R-squared: 0.6386, Adjusted R-squared: 0.6365
## F-statistic: 302.1 on 1 and 171 DF, p-value: < 2.2e-16
For the single-variable model, \( R^2 = 0.6386 \), so 63.86% of the variance in a nation’s life expectancy can be explained by its linear relationship to education. For a single variable model, this is a pretty high \( R^2 \). Note that when we fit model_2
, the \( R^2 \) only went up to 64.48%, all while taking away a degree of freedom from the model - further evidence that status
is not a worthwhile predictor in this context.
To quantify the model’s error, which, again, comes down to residuals, we can look at Root Mean Square Error (RMSE), another highly common regression diagnostic. It is defined as: \[ RMSE = \sqrt \frac {\Sigma_{i=1}^n (\hat y_i - y_i)^2} {n}\]
and as you might intuit from the formula, RMSE is a measure of the standard deviation of residuals. RMSE can be computed using the metrics
package, or just using a quick manual calculation:
sqrt(mean(model_1_df$.resid^2))
## [1] 4.97418
Our calculated RMSE of 4.974 indicates that actual life expectancy deviates from life expectancy predicted by the model by about 5 years, on average.
Outliers & Influential Observations
Another way to assess model performance is to figure out whether it was influenced by a small set of influential observations. Perhaps our model started out as a perfectly nice model, chugging along, predicting stuff with few mistakes. But then it came across some highly influential characters - data points that don’t hang with the pack, non-conformers, and they applied heavy influence and ultimately swayed our model off its course.
In truth, the study of outliers and influential observation is a whole thing and worthy of its own project. For now, let’s do two things. First, let’s look at Figure 2 and acknowledge that there’s not much visual evidence of outliers. Second, let’s do a quick check using Cook’s distance, .cooksd
in our augment()
dataframe.
Cook’s distance is a metric based on deleted residuals and is calculated for each data point in the set. It is a measure of the difference that would occur in our predicted values if we were to re-run the regression model without that point. Let’s look at the Cook’s distances in model_1
:
model_1_df %>%
arrange(desc(.cooksd)) %>%
inner_join(lifexp_df, on = life_expectancy) %>%
head()
## # A tibble: 6 x 29
## life_expectancy schooling .fitted .se.fit .resid .hat .sigma .cooksd .std.resid
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 63.6 5 53.3 1.09 10.3 0.0473 4.95 0.111 2.11
## 2 63 5.1 53.5 1.08 9.48 0.0462 4.96 0.0912 1.94
## 3 49.7 9.1 62.7 0.611 -13.0 0.0149 4.92 0.0518 -2.62
## 4 77 9.9 64.5 0.532 12.5 0.0113 4.92 0.0360 2.51
## 5 52.2 11 67.0 0.443 -14.8 0.00785 4.89 0.0351 -2.98
## 6 52.7 9.7 64.1 0.551 -11.4 0.0121 4.94 0.0321 -2.29
## # … with 20 more variables: country <fct>, year <int>, status <fct>,
## # adult_mortality <int>, infant_deaths <int>, alcohol <dbl>,
## # percentage_expenditure <dbl>, hepatitis_b <int>, measles <int>, bmi <dbl>,
## # under_five_deaths <int>, polio <int>, total_expenditure <dbl>, diphtheria <int>,
## # hiv_aids <dbl>, gdp <dbl>, population <dbl>, thinness_1_19_years <dbl>,
## # thinness_5_9_years <dbl>, income_composition_of_resources <dbl>
We can see that our top five most influential observations are Eritrea, Niger, Sierra Leone, Bangladesh, and Lesotho. To complement using a quick visualization:
model_1_df %>%
mutate(id = row_number()) %>%
ggplot(aes(x = id, y = .cooksd)) +
geom_point() +
theme_bw()
We see three points (Eritrea, Niger, Sierra Leone) that stand out from the pack. These observations are not just outliers, but influential outliers, meaning they swayed our model towards themselves, compromising its predictive capability.
So what do we do with them? You can find lots of different “rules of thumb” online, dictating which Cook’s distance might prompt removal of a data point from your set, but what makes most sense to me in this situation is to accept the data as they are. We don’t have any super high leverage points here, and even if we did, we would need justification for removing them. As you can probably intuit, few natural processes are simple enough to be accurately explained by a linear model. Hence the discovery/invention of more sophisticated probabilistic models and machine learning. But suffice it to say, we’re leaving Eritrea where it is.
Step 3: Validate Regression Assumptions
Now that we’ve done all this work, we need to figure out whether any of it was worthwhile. This is a bit of a nuisance with linear regression - you can’t really check the assumptions before you fit the model because you need the model to know if the assumptions were satisfied.
You’ll often see regression assumptions summarized as follows:
- Linearity: If the data aren’t linear, don’t fit a linear model. We looked at the scatterplot in step 1 and found it was pretty linear.
- Independence: Observations shouldn’t be clustered or have any influence on other observations. It’s hard to say this is the case in our situation, since it’s pretty clear that developing countries and developed countries cluster together and through political and economic means influence their neighbors’ policies and practices.
- Normality of residuals: If you look at the residuals in Figure 3 and superimpose little sideways bell curves along the regression line, you should see that the residuals are normally distributed. Basically, the majority of the residuals are located close to the line and a few are found further away. This is best explained visually: It looks like this is generally the case for our model, using the trusty eyeball method.
- Homoscedasticity 1: Homoscedasticity means that the variance of the residual terms is somewhat constant. If your data are heteroscedastic, linear regression modeling is probably not a good choice. Here’s an example of heteroscedasticity:
When we first looked at our data in scatterplot form, we noted some definite heteroscedasticity. Let’s look at it again:
final_df %>%
ggplot(aes(x = schooling, y = life_expectancy)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
labs(
title = "Life Expectancy vs Schooling"
)
Below 10 years of schooling, our residuals are much wider than on the other side of 10. There might be some intuitive explanation for this observation. For instance, it’s possible that there’s a distinction between countries where a majority of the population finishes what is considered high school in the US and countries where that isn’t the case. In these countries, years of schooling doesn’t matter as much as other factors - like access to clean water and nutritious foods.
All in all, checking regression assumptions convinced me that linear regression might not be the best choice here. Or at least not on its own. But we did learn some good fundamental principles about how statistical modeling works.
Conclusions
After going through a fairly brief analysis, we learned that:
- Globally, the relationship between life expectancy and education based on WHO data is fairly linear, with a simple model resulting in an \( R^2 \) of 0.64.
- Few influential outliers were present in the data.
- In order to build a more robust model, data should be limited to a range where the linear regression assumptions (namely, homoscedasticity) are met. Otherwise, a more robust modeling strategy should be used.
Further Reading
- In-depth overview of regression modeling with different types of predictor variables
- Good intro to model selection
- Explanation of differences between RMSE, \( R^2 \), and other measures of model error
- A nice interactive OLS explainer
- Everything you ever wanted to know about residuals here
- Great lecture on outliers
References
- Jenkins-Smith, H. C. (2017). Quantitative Research Methods for Political Science, Public Policy and Public Administration (With Applications in R): 3rd Edition. University of Oklahoma
- Field, A. P., Miles, J., & Field, Z. (2012). Discovering statistics using R. Thousand Oaks, CA.
-
If you’re a spelling bee organizer, I recommend adding this word (mostly because I still misspell it almost every time I write it). ↩


Variables
Variables are used to store values that will change throughout the execution of the program.
int
types are used to store integer eg: 3
double
types are used to store floating value, it can also store integer too eg: 3.1415, 3.0
char
types are used to store single character eg: 'a'
boolean
types are used to store true/false value eg: true
An unique variable name is assigned to a variable type to serve as identifier
int a = 5;
Practice
using namespace std ;
int a = ;
double b = ;
char c = ' ' ;
boolean d = ;
cout<<" a = "<< a << endl ;
cout<<" b = "<< b << endl ;
cout<<" c = "<< c << endl ;
cout<<" d = "<< noboolalpha << d << endl ;
int a = ;
double b = ;
char c = ' ' ;
boolean d = ;
cout<<" a = "<< a << endl ;
cout<<" b = "<< b << endl ;
cout<<" c = "<< c << endl ;
cout<<" d = "<< noboolalpha << d << endl ;
Output
a =
b =
c =
d = true
b =
c =
d = true


Toggle navigation
Interact.io
Interact API Documentation
How-To's
Get a key
X
Don't have an account?
Want to test our API's?
It's simple and easy log into
Leadscore.io
or
myContacts.io
and test our API's!!!
Authorization
Docs
Internal API
Inbox API
Outbox API
Statistics API
Vault API
Help
Interact API
CRM MicroServices Platform
RESTful API's of Interact.io is supported with
technical documentation
,
sample code
so you can start-up and access quickly.
Try it


Chocolate Pizza
POSTED ON 15 DEC 2013 / DESSERT
For the fig.in: Walter mer mom heAT M A SACANAN. Anchrown sugar and stir endisse Halve all of the Lijs ad toes in die saucepaal with water and lemon juice Cooker medium deal, staring feveady, and you have a chunky jammy mixturc. Add salt with one or two stirs, set aside and let cool completely.
Ice cream : 1n a small at over medium heat, cam Vinamilk and grand sugar ungar is completely dissolved andre mülk is just butely lukewarm. Whick in die solks. Sel mixture in die lani wait until the Eg mixture is cooled.
using an ice cream machine pour quid ma the frozer basin and process according to manufacturer instructives, i.e. Let sic ad ducket for 20 min. becue adiving, mascarpone, Ligjan mixture, and the ul. Continue to process for 10 minutes. Pour scmi frozen mixture into a fyrex dish or glass tupperware Freeze befor serving.


upload books
All books
Books
Software engineering
JavaScript
Databases
Design
Recent
To-reads
Archive
LAST OPENED BY ME
More
Java script
Java script


The choice to embark on a new challenge like programming can be daunting and intimidating. Many factors will go into how your journey unfolds. One of those factors is choosing which languages to learn first. This can be a difficult decision, due in large part to the variety and choices that exist.
Some languages you may have heard of include:
Regardless of which languages you choose to focus on, learning any of the above will help you on your journey. In the intereset of helping new entrants navigate this process, i've developed a simple five question survey that can help you determine which path to start down.
You should check out Hoon. Hoon is a new language recently written by the team developing a project named Urbit. You seem like a good fit for a new challenge.
Yep. Definitely JavaScript. With your extensive experience, JS will come naturally, while keeping you challenged.
The simplicity and readability of Python will help you see the bigger picture, while being powerful enough to build great projects


% layout('getx_layout_en.html') -%>
04-10
Inschain studied the original spirit of insurance deeply and demonstrated that the mutual aid model based on blockchain technology will strongly benefit members. In this regard, we are launching the Million undergraduates accidental mutual aid project which will the first product based on this forward-looking model. Our unique design features perfectly combine protection and care and truly realizes the relationship between contribution and deserve; love and care.
This product will be on live at Inschain mutual aid platform. The platform fully integrates the spirit of crowdsourcing and allow every member to participate in the product design section. Brilliant ideas will be summaries as the ballot and once passed by all member; the Inschain product development team will integrate these ideas into actual application. Inschain platform strive to create a million level mutual aid community that combines blockchain and insurance.
This product protects aganist personal accidents and has the following characteristics.
• settlement method: GETX; • age of admission: 16-60 years of age; • Recharge requirements: a single recharge is not less than 30GETX; • Wait period: 30 days after joining the plan. • total compensation in a single event: accidental event does not exceed 100 thousand GETX; while commercial airline accident does not exceed 1 million GETX; • Per person donation: in a single accident does not exceed 10GETX. • Operation management fee: after the end of the waiting period, the 0.01GETX/ person/day will be charged. • Grace period: 30 days after balance drop below 10 GETX ( Resume Benefits after recharging)
When accidents happen, the Inschain closely consider the urgent needs of applicants and the benefits of the member. Thus we had following procedure for mutual assistance fund application.
• third party agencies are invited to investigate the authenticity of events independently. • The findings were publicized and must agree by all members. • Beneficiaries need to pay the start-up fee to initiate the investigation; • A quick collection of mutual assistance fund through smart contracts
About the specific terms and condition of products and mutual aid process, please read the related document on the inschain website


Sweet Toothed
_____________________________________________________________________________________________________________________
Healthy : Hot Cross Buns
Text
Chromes version.meaning that you can enjoy these tasty treats when ever you feel like them.
_____________________________________________________________________________________________________________________
Peanut Butter & Chocolate
Text
There is nothing better then curling up under a blanket on the couch
with a cup of hot chocolate and some delicious treats.
The problem is that we end up gaining unwanted weight.
To help you enjoy these crunchie treats the Chrome team has come up with some mouth-watering healthy treats.
Chrome's version
_____________________________________________________________________________________________________________________


Your browser does not support HTML5 video.


Google, Facebook, YouTube, Yahoo, Wikipedia, Hotmail (Windows Live), Twitter, LinkedIn, Amazon.com, WordPress.com, eBay, Bing… You may know probably all these companies; we use some on our daily basis. They bring services to around 2 billion people! And influence our lives everyday. The most influential Internet companies are in the search engine and social media category, so I will focus the analysis in these two.
Search Engines
-
Google -> 1,000,000,000 = 1 billion unique visitors /month
-
Yahoo! Sites -> 689,000,000 unique visitors /month
-
Bing/Microsoft Sites -> 905,000,000 unique visitors /month
Social Media
-
Facebook: 750,000,000+ users
-
Twitter: 200,000,000 users
-
Gmail: 193,000,000 users
-
LinkedIn: 100,000,000+ users
-
Flickr: 32,000,000 users
-
Google+: unknown yet, but growing quickly!
All these websites have something in common: huge amount of traffic! So, there technologies should scale, support high concurrency and easy to maintain. All these features are a good measure to know what programming language you should focus next. Learn from what is already working. All right! Now comes the interesting part! Let see what is happening behind the scenes!
Facebook
Technologies used:
-
PHP (main programming language)
-
HipHop for PHP (translate PHP to C++)
-
MySQL (database)
-
Cassandra (distributed database management system)
-
Memcached (distributed memory cache)
-
Thrift (integration between many programming languages)
-
Other languages: Java, Erlang, C++, …
-
A lot of tweaks for optimization, custom extensions. For instance, they used modified a Linux distribution to optimized it for Memcached.
Who else uses PHP as main language?
Facebook, Wikipedia, Digg, CMS, and many more…
Who else uses Memcached?
YouTube, Facebook, Twitter, Reddit, Zynga. CMS (Drupal, Joomla, WordPress)
Twitter
Technologies used:
(Be aware that Twitter keeps changing their technologies as they scale. So the list will be kinda chronologically)
-
Ruby (initially 2006). Ruby on Rails for the web interface and an enhanced Ruby Enterprise Edition.
-
Memcached (distributed memory cache)
-
MySQL (database)
-
Starling (2007-2008): lightweight persistent message queue server written in Ruby.
-
Outages: (it’s not a technology, duh. But, gives an idea why they make some changes later) In 2007, Twitter had been down 2% (equivalent to 6 full days). Especially in big events.
-
Scala (in 2009): is multi-paradigm object-oriented programming language. In April 2009, Twitter changes large portions of their backend from Ruby to Scala.
-
Lucene (in 2011): for their real-time search engine they are change it from MySQL to Lucene.
-
Java (In 2011): They are replacing Ruby on Rails for Java in their search infrastructure. They announce performance improvements in their search engine 3x and 10x throughput.
-
What’s the next change? …Stay tune ;)
Who else use Scala?
Foursquare, Twitter, …
Google
It’s a mystery what they really use, but here are some hints:
-
C++: for high-performance applications and search engine capabilities.
-
They use a lot of Java and Python.
-
Python: is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability (wikipedia).
-
Big Table: is a compressed, high performance, and proprietary database system.
-
Google File System: Google’s distributed file system to access data efficiently using large clusters.
-
Google Closure Tools: JavaScript tool for rich web applications. It’s used in Gmail, Google Maps and Google Docs.
-
Google Web Toolkit: used to create complex JavaScript front-end in Java. The Java code is “compiled” in JavaScript it’s the general idea.
-
Ajax (Asynchronous JavaScript and XML). It’s used in Google Maps, Google.com and many other Google apps.
Who else use Python?
YouTube, BitTorrent client, Google, Yahoo, NASA… Used for Artificial Intelligence too…
In a next post, I’ll continue with the other ones…


Grime star D Double E is the surprise face of IKEA’s first ever Christmas advert
"I must confess, this place ain't bless, this place is a mess."
Grime star D Double E has emerged as the unlikely star of IKEA’s first ever Christmas advert, after lending his voice to the festive offering.
The advert from the Scandinavian homeware giants launched in the UK and Ireland today (November 8) and aims to encourage people to open their homes to guests across the festive season.
It features a couple who are waiting for guests to arrive when their ornaments spring to life and mock them about the state of their home – with each item voiced by D Double E.
The veteran London MC is first heard as a rabbit shaped teapot and then goes on to voice items including a pair of snail salt & pepper shakers, a Japanese good luck cat, and a particularly judgemental dinosaur.
“I must confess, this place ain’t bless, this place is a mess. This table is older than the pyramids, at least it’s older than the mirror is,” he raps on the track.
It seems that he gets the message across too, as the family eventually head to IKEA to buy a selection of items.
IKEA’s Sarah Green said: “Our first IKEA Christmas advert focuses on the phenomenon of ‘home shame’ – encouraging people to overcome the negative voices in their head holding them back from open up their homes.
“It was born from the common feeling that, along with the seasonal joys, a lot of us feel a looming sense of dread when it comes to hosting others with many of us feel ashamed of our homes over the Christmas period.”
Last year, D Double E finally released his anticipated debut album ‘Jackuum’.


Saba’s current focus is to build Advanced UI applications using Angular, React, Vue and a suite of UI technologies
Our UI specialists can help build custom applications for your organization,
below are few examples that are high profile and high-quality applications built with Angular..
Adarsh Krishnamurthy
(CEO & Co-Founder)
A Passionate Individual and Development Lead
Bharath Vyas
(CFO and Co-Founder)
Dedicated in going beyond Customer Expectations
Adarsh Achar
(CTO and Co-Founder)
A Technocrat who is the key in implementing every latest Technology
Sachin Jambur
(Chief Architect and Co-Founder)
An Architect of all architects


Development Project
This project started out as a declaritive UI programming exercise (using the React.js framework) to create a simple frontend application in React.js that would actually be useful to a student like me.
The application itself is a simple "Shopping Cart" implementation themed around 1000-level computer science (CS) courses offered at Brown University. All course information in this repository were pulled from the Courses@Brown website and The Critical Review.
Goal & Functionality of Application
The goal of this application is to help users pick and choose from a set of 1000-level CS courses at Brown while also keeping track of the estimated weekly commitment required in hours. Thus, users can easily plan which computer science courses to take in a semester without being surprised by an unmanageable workload.
Users can view a set of 12 CS courses and choose which ones to add to their "course shopping cart". The cart adds together the total weekly hours of each added course and conveniently displays the number to the user.
To see the final deployed product, click on this link.
To see the source code for the app, click on this link.
Usability Principles Considered
To make my application intuitive and pleasant to use, I kept the following usability principles in mind:
- Learnability
- There is space between the shopping cart and the course gallery with the viewing options to keep these two sections distinct.
- No potentially confusing icons are used in the interface: buttons linked to specific actions contain descriptive text (e.g. 'Add to Cart' button).
- Interface layout is similar to the typical one-page shopping site, so users can easily trans
- Clicking any non-disabled button in the interface will result in an immediate action which can be undone if desired (e.g. filtering, sorting, adding and removing items from cart).
- Memorability
- Courses can only appear in the shopping cart once, so once an item is added to the cart, the 'Add to Cart' button is disabled and changed to say 'Added to Cart'.
- Efficiency
- Useful filter and sort options are included in the view options section above the course gallery so that users can more easily find courses that fit into their schedules.
So, without further ado, let's dive into the juicy details!
Technical Details
All source code is available on Github.
This section outlines the architecture of this project and includes the following details:
- Organization of components
- How data is passed down through components
- How user interactions can trigger changes in the state of components
Component Organization/Hierarchy
When going into this project, I wanted my code to have a relatively flat structure to stay as concise and easy to understand.
There are 3 main components:
- App: the root component of the app; contains all logic involving user interaction (i.e. sorting, filtering, and adding/removing items)
- Gallery: a component that displays a list of courses as a collection of cards; this component is used for both displaying all avaiable courses as well as displaying all items in the user's shopping cart
- ViewOptions: a component that contains buttons that allow the user to filter and sort the items in the course selection gallery (not shopping cart)
The hierarchy is as follows:
App
- left section div
ViewOptions
Gallery
(Course Selection)
- right section div
Gallery
(Shopping Cart)
- left section div
Below is a screenshot of the app again for reference.
Flow of Data Between Components
App
holds all of the state values and state-setting functions. The state values and setters are
shown below:
const [semesterFilter, setSemesterFilter] = useState(SEMESTER.ALL);
const [trackFilter, setTrackFilter] = useState(TRACK.ALL);
const [sortBy, setSortBy] = useState(SORT.DEFAULT);
const [courseGalleryItems, setCourseGalleryItems] = useState(ITEMS);
const [cartGalleryItems, setCartGalleryItems] = useState([]);
(Syntax highlighting is powered by Prism.)
App
only passes the necessary values and functions to its child components:
ViewOptions
receives the values and setters for both filters and sortBy as props fromApp
Gallery
(Course Selection) receives courseGalleryItems and a function for adding courses to the shopping cart as props fromApp
Gallery
(Cart Selection) receives cartGalleryItems and a function for removing courses from the shopping cart as props fromApp
Triggering Actions Through User Interactions
UI changes are all triggered by the setter functions: setSemesterFilter, setTrackFilter, setSortBy, setCourseGalleryItems, and setCartGalleryItems.
ViewOptions
Whenever the user clicks on a filter or sort method in ViewOptions
, the corresponding setter
function is called, triggering a useEffect
hook in App
to filter, sort, and update
courseGalleryItems. This updated list of items is then passed into the Gallery
(Course Selection)
component to update the displayed course cards.
In case you're interested in how the useEffect
hook does the sorting and filtering, here it is:
// update displayed courses in the course gallery upon filter or sort change
useEffect(() => {
// start out with copy of original full course list
let newCourseGalleryItems = [...ITEMS];
// apply filters
newCourseGalleryItems = newCourseGalleryItems
.filter(x => semesterFilter === SEMESTER.ALL || x.semester === semesterFilter)
.filter(x => trackFilter === TRACK.ALL || x.track === trackFilter);
// apply sorting
if (sortBy !== SORT.DEFAULT) {
newCourseGalleryItems = newCourseGalleryItems
.sort((a, b) => {
return sortBy === SORT.HOURS_ASC
? a.weeklyHours - b.weeklyHours
: b.weeklyHours - a.weeklyHours
});
}
// save new list of course items
setCourseGalleryItems(newCourseGalleryItems);
}, [
semesterFilter,
trackFilter,
sortBy,
setSemesterFilter,
setTrackFilter,
setSortBy,
setCourseGalleryItems,
]);
(Syntax highlighting is powered by Prism.)
Gallery
(Course Selection)
When the user clicks on the add button for any course card, it triggers a callback function that appends that
course item to cartGalleryItems in App
, which then is sent to Gallery
(Cart Selection)
to update the items displayed in the cart.
Gallery
(Cart Selection)
When the user clicks on the remove button for any item in the shopping cart, it triggers a callback function that
removes that course item from cartGalleryItems in App
, which is sent back to Gallery
(Cart Selection) to update the items displayed in the cart.
Conclusion
Here were my key takeaways from this project.
- React.js Hooks are really nice for writing concise code when compared to class components.
- Reducing unnecessary hierarchy in components really helps with code readability and conciseness.
- Did I mention that React.js is awesome?
This project overall was fun exercise in concise and descriptive React.js development. Although the scope of the application's current form is rather limited in terms of content and filtering/sorting, the structure of this project should make future extensions or spinoffs easy to do.


In the summer of 1999, the U.S. Women's National Soccer Team defeated China to win the Women's World Cup in the Rose Bowl, the climax of a three-week, 16-team tournament that remains history's most successful women's sports event, drawing more than 600,000 spectators. It also represented the most visible achievement of the women's sports movement in the United States since the 1972 enactment of federal Title IX, which required schools and colleges to provide equal sports opportunities to girls and women. Athletes like Brandi Chastain and Julie Foudy, who led that team to the World Cup, spawned the Women's United Soccer Association in 2001, the world's first women's professional soccer league. But in 2003, after only three seasons, the league folded, and team organizations created by some of the most accomplished athletes and administrators in women's sports were disbanded.
The Bay Area Women's Sports Initiative - BAWSI - arose from the remnants of that effort, created to ensure that the WUSA would not be the zenith of a short-lived golden age of women's sports but rather another step toward women's full achievement in the sports world. BAWSI's programs began with a critical look at the unmet needs in our community and took shape after imagining a profound change for a better world.


All widgets on {{vm.workspace.userWorkspaceName}} will have to be recreated and unsaved information will be lost.
If you do continue, then {{vm.totalWorkspaces[vm.next].userWorkspaceName}} will become your new landing workspace for future logins. Also, all widgets on {{vm.workspace.userWorkspaceName}} will be removed and unsaved information will be lost.


;
React Router Basic Nav
Topics:
-
Single Page Applications
-
React Router V4 (react-router-dom)
-
Routing, declarative component based routing
-
Path and Component
Project Description
-
A starter pack project for all things React Router. Learn to set up a basic routing system within an application. Use this application to help guide your learning over the next couple of days.
-
Note that this project has already been boilerplated for you. There is no need to run any installation steps beyond
yarn install
.
Initialize Project
-
cd into the repository and run
yarn install
-
run
yarn start
Steps for implementing React Router
-
You’ll notice we’ve already installed react-router-dom for you.
-
import
your BrowserRouter as Router inside your index.js
file.
-
Wrap your
<App />
component that you’re passing to ReactDOM.render()
with your new Router
component.
-
open up your chrome
REACT DEV TOOLS
and notice your app is now all wrapped in BrowserRouter
-
inside the
REACT DEV TOOLS
expand <BrowserRouter>
and highlight <Router>
and notice that here is a “history”
object on props and a “match”
object on its state. These two objects are how all of our Router is going to work.
Steps for “Declaring” your routes
-
Inside of your
App.js
file import { Route } from ‘react-router-dom’;
-
This is where we’re going to declare and specify our router.
-
Create 3
<Route />
setting their path
prop equal to /
, /about
, /contact
with their respective components.
-
Be sure to incluce the
exact
prop on the root component for /
to make sure that it’s rendering the exact component and not all the other components.
Steps for setting up your Navigation
-
Inside of
Navigation.js
import { Link } from ‘react-router-dom’
.
-
Declare the
to
as the href on <Link>
and specify the correct routes for your app to navigate towards.
-
Head over to your app and start navigating. You should be able to see your URLS changing their paths as you go. Each path should display the proper component.
Resources


About the band
Hailing from The Netherlands and branded with their signature skull, Dutch duo DROELOE have taken the 'future bass' scene by storm. What began with a SoundCloud account - where they uploaded their own music and curated their favorite releases in their "Pokoe Pack" mixes - soon developed a reputation for creating impeccable percussion-heavy future bass infused with the catchiest melodies. Comprised of producer Vincent Rooijers and visual designer Hein Hamers, the duo's emphasis of both the music and visuals through both members' strengths has seen them weave intricate stories through both the music and visuals.


Dieupeul 3 Villa 2545 Dakar,Senegal. Dear Sir, I am Mamadou Sidibie, from Senegal, west Africa.I have contacted you for a possible Investment assistance.I have the amount of US$18 Million dollars ready for investment.I am still serving in the government as a minister of planing and development,i will be retireing in the next couple of months due to my heart ailments.I will be glad to meet with you in any country of your choice for discussions on how to invest the said fund in your country.Please, do confirm to me your mutual interest and capability to assist me in investing my funds in your country upon my retirement in the next few months and also furnish me with your telephone and fax numbers for easy commucations. Waiting for your earnest reply.Until then, I remain with the best regards. Mamadou Sidibie.


checks if this container has any mods
checks if theres more place for a mod with their generationtype
generation type
truncates mods
removes an existing mod
lists all the stats that are offered by its mods
mods can have multiple stats so we sum their values grouped by stat id
Generated using TypeDoc
adds a new non-existing mod


MySeriesList
{{list.listName}}
{{singleseries.seriesName}}
Rating: {{singleseries.rating}} / 10
1x01
{{singleseries.currentSeason}}x0{{singleseries.currentEpisode}}
= 10" class="white bg-style bigger">
{{singleseries.currentSeason}}x{{singleseries.currentEpisode}}


You need to shop ASAP. Get your gifts tomorrow with $10 overnight shipping. Plus, 30% off full-price styles & extra 40% off sale.


SVG Clock examples
London (or your local time)
2 hours ahead with hand bounce
New York (-5)
Fixed time (21:38)
Download at
GitHub
|
Studio 24


[gecode-users] Removing constraints from a Space
Nacho
ncasti at fdi.ucm.es
Mon Jan 25 18:41:07 CET 2010
Hi all,
I am using Gecode for reason about models. I know how to add new constraints
from anywhere in my C++ application, but I don't know how to remove any of
the constraints previously imposed. I have read the Modeling with Gecode
documentation, but I haven't found any reference on how to do it. Is it
possible?
Thank you very much in advance.
Nacho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20100125/ce95c9cc/attachment.htm>
More information about the users
mailing list


|
Class Summary |
| ChartConfig |
The configuration for painting a flowchart, including the size, the position and
the color of each element in the flowchart. |
| FlowchartSymbolFactory |
This is a factory for creating symbols in a flowchart. |
| IfStatement |
A IF statement consists of a condition (denoted by a diamond) and one or two
branches (represented by a StatementSequence respectively). |
| LabelDimension |
A utility class for calculating the height and width of a label in HTML format. |
| Module |
An instance of a Module consists of zero or more instances of Procedure, which
are held in a Map. |
| PrimitiveStatement |
This is an abstraction of a sequence of primitive statements (e.g. assignments
and I/O statements). |
| Procedure |
An instance of a Procedure consists of a sequence of statements. |
| StatementSequence |
An instance of a StatementSequence contains a list of instance(s) of
AbstractStatement. |
| WhileStatement |
A WHILE statement consists of a condition (denoted by a diamond) and one loop
body (represented by a StatementSequence). |


Navbar
Home
About
Contact
Services
Login
Signup
Welcome my baby...
Ride along, because it's cruise all night long.
Sign Up


Conway's Game of Life (03/13/2021)
A web browser game based on Conway's Game of Life. The Dev Blog
Online Forum Political Discussion Scrapper (Mid Feb 2021)
A web scrapper for scrapping the hottest and latest political discussions from mainland China and Hong Kong based online discussion forums.
AUX (Oct 2020)
An app in React Expo that allows people to play musics to others remotely.
Simple Shooting Game (Nov 2020)
A simple text-based shooting game in Java.
(Math Summer Research) Chains with a variety of distance functions in vector spaces over finite fields (Summer 2020)
Studied the chains with underlying functions as either the distance function or the dot function by conducting numerical experiments with primes up to 1,000,000.


AWS Systems Manager MaintenanceWindowTask NotificationConfig
The
NotificationConfig
property type specifies configurations for sending
notifications for a Maintenance Window task in AWS Systems Manager.
NotificationConfig
is a property of the MaintenanceWindowRunCommandParameters property type.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "NotificationArn" :
String
, "NotificationType" :String
, "NotificationEvents" : [String
, ... ] }
YAML
NotificationArn:
String
NotificationType:String
NotificationEvents: -String
Properties
NotificationArn
-
An Amazon Resource Name (ARN) for an Amazon SNS topic. Run Command pushes notifications about command status changes to this topic.
Required: No
Type: String
Update requires: No interruption
NotificationType
-
The notification type.
-
Command
: Receive notification when the status of a command changes. -
Invocation
: For commands sent to multiple instances, receive notification on a per-instance basis when the status of a command changes.
Required: No
Type: String
Update requires: No interruption
-
NotificationEvents
-
The different events that you can receive notifications for. These events include the following:
All
(events),InProgress
,Success
,TimedOut
,Cancelled
,Failed
. To learn more about these events, see Understanding Command Statuses in the AWS Systems Manager User Guide.Required: No
Type: List of strings
Update requires: No interruption


Workshop on creating R packages in windows
12 Jun 2013This post is dedicated for those useRs interested in becoming creatoRs, especially those working under windows. Here are the slides of my workshop "Create your first R package (in windows)".
Becoming a creatoR
Every year more and more R packages are developed and shared among the R community. It has been amazing to see the exponential growth of packages contributed to CRAN in the last five years (or so). Moreover, the availability of tools for making the developers' life easier has been incredible (eg devtools, testthat, roxygen2, rd2roxygen, knitr)
With all these trends it would be tempting to say that now anybody can quickly switch from being just a useR to being a creatoR. How hard can it be? Well, the truth is that for many useRs, creating an R package is still a dream. Especially if you have very limited programming experience, or if you just have a basic knowledge of R, creating an R package on your own can be a truly challenge that will put your patience to the test. And on top of that, is even worse if you are working on windows: sooner or later it becomes a fu#$ing nightmare.
I learned how to develop R packages on my own. And to be honest, it was a very frustrating experience. Moreover, most people I know that have developed R packages, have gone through the same burden I went through.
I still remember my first failed attempts to make an R package and how demoralizing it was. I used to think that the only reason why I wasn't able to create an R package was simply because I was just a very bad apprentice (i.e. stupid). I don't have any data about the number of people that have learned how to create R packages by themselves, but I would like to think that we are the big majority.
I know we all can have access to the manual Writing R Extensions (by R Core Team). This manual is the official source of information containing all the details on how to create a package in R. By the way, I don't like the name of the manual. I would simply call it "Creating R Packages" (but that's a personal opinion). Virtually everything you want to know is there. The problem is that, admittedly, the manual is NOT beginner friendly whatsoever.
There are many tutorials and documents available online dedicated to show how we can create R packages. But since I just recently gave a workshop on this topic, I decided to add my two cents. So in this post I'm sharing my slides (and other material) under the series: Create your first R package (in windows). Here's the list of discussed topics:
- Introduction
- Part 1: Setting up your PC
- Part 2: Anatomy of an R package
- Part 3: Standard development
- Part 4: Building and Checking
- Part 5: Develop smarter, not harder
The aim of the slide materials is to give you a basic description of the development process. I don't pretend to cover everything, just enough so you can have a starting point. But hopefully these slides can help you avoid some useless R packaging suffering. The goal is to help you make the transition from being just a useR, to start being a creatoR.


You will be presented with a sequence of {{ params['num_ims'] }} images and asked to guess if the image is one of the following:
{% for cc in range(params['class_names']|length) %}
{{ params['class_names'][cc] }}
{% endfor %}
After every guess you will get feedback so you can answer better in the future.


Release Grade
Check Grade
Aurora2 Grade Release System
Only Professor can annouce information,students can query their grade
Enter Student's Score here
Course Code
Student Name
Student Number
Assignment Score
Assignment Precentage
Project Score
Project Precentage
Exam Score
Exam Precentage
Submit


Spending per person vs GDP per person (2013, 2017)
Military Spending per person (2013)
Military Spending per person (2017)
Educational Spending per person (2013)
Educational Spending per person (2017)
Healthcare Spending per person (2013)
Healthcare Spending per person (2017)
GDP per person (2013)
GDP per person (2017)


StudioPress just released Minimum Pro Theme to Genesis Framework users.
I recently wanted to substitute a slider on the homepage instead of a static featured image. I’ll post the solution here in case you’d like to try it yourself. (btw – just giving a thanks – Ted helped me out a ton!)
CREATE A NEW WIDGET AREA
The featured image used in the Minimum Pro Theme demo is hard-coded into funtions.php. We’re going to change this by creating a new widget area for our home page slider.
To register a new widget area, drop the following into your functions.php (between header and tagline widgets on homepage).
After adding this code to your theme and saving it, you can go to Appearance > Widgets and see your new widget area. You can drop widgets in there and add content all you like, but it won’t show up on your home page until we tell it to do so.
ADD THE NEW WIDGET AREA TO THE HOME PAGE
Add this to functions.php:
Then REMOVE (on functions.php):
Removed:
And on front-page.php, remove or comment out:
Done!


Loading Files: Either select files in your system file explorer and drag and drop on the 'Choose Files' button or click the 'Choose Files' button and select files from the system file dialog. Multiple files can be loaded.
Files: Event Group: Event Name: Secondary (Near) Event Group: Secondary (Near) Event Name: Sort By: Name Dosages Sampled


My name is Abdallah Alkhatatbeh , I'm 22 years old , I'm network engineer , I graduated from Alblqaa University, I am here on this course to increase my programming skills I have a simple background in programming by virtue of my undergraduate major
I hope to become a better person in programming, and to increase my web design skills.


Levels
(
lvls
)
- Parameters:
-
lvls <array>
an array of string names of the logging level in the good order


Learning Ansible Roles
with Fen Howieson
Step 1 - Wake Katie Up
Step 2 - Feed her breakfast
Step 3 - Go round for her friends


Cyber Client
Menu
Home
About
About Me
MASIH KOSONG
Facebook
Instagram
quote
Thanks for everyone
Primary
Default


Sweet Free Stuff
///////////////////////////////////////////
Free Source Naturals Theanine Serene Sample
Posted: 11 Jul 2016 11:50 AM PDT
http://feedproxy.google.com/&edburner&utm_medium=email
Free Source Naturals Theanine Serene Sample
The post Free Source Naturals Theanine Serene Sample appeared first on
SweetFreeStuff.com.
///////////////////////////////////////////
Free Subscription to Parents Magazine
Posted: 11 Jul 2016 06:30 AM PDT
http://feedproxy.google.com/&edburner&utm_medium=email
Free Subscription to Parents Magazine
The post Free Subscription to Parents Magazine appeared first on
SweetFreeStuff.com.
CommentsThank you!!! by Connie FarrellThank you kindly. by minkieThank
you.. by Craig
///////////////////////////////////////////
Free Slurpee at 7-Eleven on July 11th
Posted: 10 Jul 2016 10:00 PM PDT
http://feedproxy.google.com/&edburner&utm_medium=email
On July 11th from 11am and 7pm get a free Slurpee drink at 7-Eleven for
7-Eleven Day.
The post Free Slurpee at 7-Eleven on July 11th appeared first on
SweetFreeStuff.com.


| Methods' Details |
getToolkit
- Description
- returns the toolkit which created this object.
|
|
setPointer
| [oneway] void |
| setPointer( |
[in] XPointer |
Pointer ); |
- Description
- sets the mouse pointer.
|
|
setBackground
| [oneway] void |
| setBackground( |
[in] ::com::sun::star::util::Color |
Color ); |
- Description
- sets the background color.
|
|
invalidate
| [oneway] void |
| invalidate( |
[in] short |
Flags ); |
- Description
- invalidates the whole window with the specified
InvalidateStyle.
|
|
invalidateRect
| [oneway] void |
| invalidateRect( |
[in] Rectangle |
Rect, |
| [in] short |
Flags ); |
- Description
- invalidates a rectangular area of the window with the specified
InvalidateStyle.
|
|
Top of Page
Copyright © 2013, The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the Apache feather logo, Apache OpenOffice and OpenOffice.org are trademarks of The Apache Software Foundation. Other names may be trademarks of their respective owners.


Chromecast Lightningbag
Tony Bergeron
Overview
Communication
Creating an App
Communication
Chromecast is the middle man between the Sender and the Receiver
Communicates locally with device over wifi
Fetches content from the cloud*
Sender App
Android, iOS or Chrome App
Receiver App
HTML5/JavaScript Webapp
Comparison to Other Products
Chromecast
Device tells Chromecast what to display
Chromecast Streams/Fetches the content from the cloud*
AirPlay
Content is streamed through the device
Display is Extended/Mirrored of the device
Miracast
Mirrors the display of the device
Communication Diagram
How we get connected: DIAL
DI
scovery
A
nd
L
aunch
Automatically hunts for available devices
Handles the pairing process between sender/receiver app
[2] Device clicks "Cast" from app
[1] DIAL Receiver launches appropriate receiver app
Creating your first Castable App
Create a Sender App
Chrome
Android
iOS
Create a Receiver App
HTML5/JavaScript
Publish your app:
https://cast.google.com/publish/
Lifecycle
Cast
Send App Info
Get App Info
App Location
Initialize Receiver
Connection
Debugging
http://[chromecast-local-address]:9222
Use Router or Chromecast manager to get the IP
http://
:9222
Go
Demo
Hello Cast
Sender API: Chrome
Chrome API
chrome.cast.Session
sendMessage
Receiver API
Receiver API
cast.receiver.CastReceiverManager
getSender
getSenders
getCastMessageBus
cast.receiver.CastMessageBus
send
broadcast
Followup
https://developers.google.com/cast/
https://github.com/googlecast
http://www.dial-multiscreen.org/
end


Tutorials¶
The GalSim/examples
directory contains demo files serve as tutorials on how to use the
GalSim code.
There are versions of each demo in both Python (demo*.py
) and YAML (demo*.yaml
).
The demos start fairly simple and progress to more sophisticated simulations, adding
a modest number of new features each time with copious documentation about the new features
being introduced.
The YAML files are run using the galsim
executable, which parses the YAML file into a Python
dict and runs this through The Config Module in GalSim. For complicated simulations,
we generally recommend using config files such as these, since they tend to be more quickly
readable than the Python scripts, which makes it easy to see how to modify them to effect
some desired change in the simulation. For more information about running the galsim
executable, see The galsim Executable.
Both versions of each demo produce identical output files. Internally, this serves as a useful test of the config parsing code. But it also serves as a kind of implicit documentation about how some of the config features are handled by GalSim.
Demo 1¶
This first demo is about as simple as it gets. We draw an image of a single galaxy convolved with a PSF and write it to disk. We use a circular Gaussian profile for both the PSF and the galaxy, and add a constant level of Gaussian noise to the image.
New features in the Python file:
obj = galsim.Gaussian(flux, sigma)
obj = galsim.Convolve([list of objects])
image = obj.drawImage(scale)
image.added_flux (Only present after a drawImage command.)
noise = galsim.GaussianNoise(sigma)
image.addNoise(noise)
image.write(file_name)
image.FindAdaptiveMom()
New features in the YAML file:
top level fields gal, psf, image, output
obj type : Gaussian (flux, sigma)
image : pixel_scale
image : noise
noise type : Gaussian (sigma)
output : dir, file_name
Demo 2¶
This demo is a bit more sophisticated, but still pretty basic. We still only make a single image, but now the galaxy has an exponential radial profile and is sheared. The PSF is a circular Moffat profile. The noise is drawn from a Poisson distribution using the flux from both the object and a background sky level to determine the variance in each pixel.
New features in the Python file:
obj = galsim.Exponential(flux, scale_radius)
obj = galsim.Moffat(beta, flux, half_light_radius)
obj = obj.shear(g1, g2) – with explanation of other ways to specify shear
rng = galsim.BaseDeviate(seed)
noise = galsim.PoissonNoise(rng, sky_level)
galsim.hsm.EstimateShear(image, image_epsf)
New features in the YAML file:
obj type : Exponential (flux, scale_radius)
obj type : Moffat (flux, beta, half_light_radius)
obj : shear
shear type : G1G2 (g1, g2)
noise type : Poisson (sky_level)
image : random_seed
Demo 3¶
This demo gets reasonably close to including all the principal features of an image from a ground-based telescope. The galaxy is represented as the sum of a bulge and a disk, where each component is represented by a sheared Sersic profile (with different Sersic indices). The PSF has both atmospheric and optical components. The atmospheric component is a Kolmogorov turbulent spectrum. The optical component includes defocus, coma and astigmatism, as well as obscuration from a secondary mirror. The noise model includes both a gain and read noise. And finally, we include the effect of a slight telescope distortion.
New features in the Python file:
obj = galsim.Sersic(n, flux, half_light_radius)
obj = galsim.Sersic(n, flux, scale_radius)
obj = galsim.Kolmogorov(fwhm)
obj = galsim.OpticalPSF(lam_over_diam, defocus, coma1, coma2, astig1, astig2, obscuration)
obj = obj.shear(e, beta) – including how to specify an angle in GalSim
shear = galsim.Shear(q, beta)
obj = obj.shear(shear)
obj3 = x1 * obj1 + x2 * obj2
obj = obj.withFlux(flux)
image = galsim.ImageF(image_size, image_size)
image = obj.drawImage(image, wcs)
image = obj.drawImage(method=’sb’)
world_profile = wcs.toWorld(profile)
shear3 = shear1 + shear2
noise = galsim.CCDNoise(rng, sky_level, gain, read_noise)
New features in the YAML file:
obj type : Sum (items)
obj type : Convolve (items)
obj type : Sersic (flux, n, half_light_radius)
obj type : Sersic (flux, n, scale_radius)
obj type : Kolmogorov (fwhm)
obj type : OpticalPSF (lam_over_diam, defocus, coma1, coma2, astig1, astig2, obscuration)
obj : ellip
shear type : QBeta (q, beta) – including how to specify an angle
shear type : EBeta (e, beta)
noise type : CCD (sky_level, gain, read_noise)
image : size
image : wcs
wcs type : Shear
output : psf
Demo 4¶
This demo is our first one to create multiple images. Typically, you would want each object to have at least some of its attributes vary when you are drawing multiple images (although not necessarily – you might just want different noise realization of the same profile). The easiest way to do this is to read in the properties from a catalog, which is what we do in this case. The PSF is a truncated Moffat profile, and the galaxy is bulge plus disk. Both components get many of their parameters from an input catalog. We also shift the profile by a fraction of a pixel in each direction so the effect of pixelization varies among the images. Each galaxy has the same applied shear. The noise is simple Poisson noise. We write the images out into a multi-extension fits file.
New features in the Python file:
cat = galsim.Catalog(file_name, dir)
obj = galsim.Moffat(beta, fwhm, trunc)
obj = galsim.DeVaucouleurs(flux, half_light_radius)
obj = galsim.RandomKnots(npoints, half_light_radius, flux)
obj = galsim.Add([list of objects])
obj = obj.shift(dx,dy)
galsim.fits.writeMulti([list of images], file_name)
New features in the YAML file:
obj type : Moffat (…, trunc)
obj type : DeVaucouleurs (flux, half_light_radius)
obj type : RandomKnots (npoints, half_light_radius, flux)
value type : Catalog (col)
obj : shift
shift type : XY (x, y)
shear type : E1E2 (e1, e2)
image : xsize, ysize
top level field input
input : catalog (file_name, dir)
output type : MultiFits (file_name, dir)
Using both ellip and shear for the same object
Using variables in a YAML file
Demo 5¶
This demo is intended to mimic a Great08 (Bridle, et al, 2010) LowNoise image. We produce a single image made up of tiles of postage stamps for each individual object. (We only do 10 x 10 postage stamps rather than 100 x 100 as they did in the interest of time.) Each postage stamp is 40 x 40 pixels. One image is all stars. A second image is all galaxies. The stars are truncated Moffat profiles. The galaxies are Exponential profiles. (Great08 mixed pure bulge and pure disk for its LowNoise run. We just use disks to make things simpler. However see demo3 for an example of using bulge+disk galaxies.) The galaxies are oriented randomly, but in 90 degree-rotated pairs to cancel the effect of shape noise. The applied shear is the same for each galaxy.
New features in the Python file:
ud = galsim.UniformDeviate(seed)
gd = galsim.GaussianDeviate(ud, sigma)
ccdnoise = galsim.CCDNoise(ud)
image *= scalar
bounds = galsim.BoundsI(xmin, xmax, ymin, ymax)
pos = bounds.center
pos.x, pos.y
sub_image = image[bounds]
Build a single large image, and access sub-images within it.
Set the galaxy size based on the PSF size and a resolution factor.
Set the object flux according to a target S/N value.
Use 90 degree-rotated pairs for the intrinsic galaxy shapes.
Shift by a random (dx, dy) drawn from a unit circle top hat.
New features in the YAML file:
gal : resolution
gal : signal_to_noise
stamp type : Ring (first, num)
value type : RandomGaussian (sigma, min, max)
angle type : Random
shift type : RandomCircle (radius)
image type : Tiled (nx_tiles, ny_tiles, stamp_xsize, stamp_ysize, border)
output type : Fits (file_name, dir)
output.psf : shift
Demo 6¶
This demo uses real galaxy images from COSMOS observations. The catalog of real galaxy images distributed with GalSim only includes 100 galaxies, but you can download a much larger set of images as described in Downloading the COSMOS Catalog.
The galaxy images are already convolved with the effective PSF for the original observations, so GalSim considers the galaxy profile to be the observed image deconvolved by that PSF (also distributed with the galaxy data). In this case, we then randomly rotate the galaxies, apply a given gravitational shear as well as gravitational magnification, and then finally convolve by a double Gaussian PSF. The final image can of course have any pixel scale, not just that of the original images. The output for this demo is to a FITS “data cube”. With DS9, this can be viewed with a slider to quickly move through the different images.
New features in the Python file:
real_cat = galsim.RealGalaxyCatalog(file_name, dir)
obj = galsim.Gaussian(fwhm, flux)
obj = galsim.RealGalaxy(real_cat, index, flux)
obj = obj.rotate(theta)
obj = obj.magnify(mu)
image += background
noise = galsim.PoissonNoise() # with no sky_level given
obj.drawImage(…, offset)
galsim.fits.writeCube([list of images], file_name)
New features in the YAML file:
input : real_catalog (file_name, dir, image_dir)
obj type : RealGalaxy (index)
obj : rotate
obj : magnify
image : sky_level
image : offset
value type : Sequence (first, last, step)
output type : DataCube (file_name, dir, nimages)
Using YAML multiple document feature to do more than one thing
Demo 7¶
This demo introduces drawing profiles with photon shooting rather than doing the convolution with an FFT. It makes images using 5 different kinds of PSF and 5 different kinds of galaxy. Some of the parameters (flux, size and shape) are random variables, so each of the 25 pairings is drawn 4 times with different realizations of the random numbers. The profiles are drawn twice: once with the FFT method, and once with photon shooting. The two images are drawn side by side into the same larger image so it is easy to visually compare the results. The 100 total profiles are written to a FITS data cube, which makes it easy to scroll through the images comparing the two drawing methods.
New features in the Python file:
obj = galsim.Airy(lam_over_diam)
obj = galsim.Sersic(n, half_light_radius, trunc)
psf = galsim.OpticalPSF(…, aberrations=aberrations, …)
obj = obj.dilate(scale)
str(obj)
image.scale = pixel_scale
obj.drawImage(image, method=’fft’)
obj.drawImage(image, method=’phot’, max_extra_noise, rng)
dev = galsim.PoissonDeviate(rng, mean)
noise = galsim.DeviateNoise(dev)
writeCube(…, compress=’gzip’)
gsparams = galsim.GSParams(…)
New features in the YAML file:
obj type : List (items)
obj type : Airy (lam_over_diam)
obj type : Sersic (…, trunc)
obj : dilate
value type : Sequence (…, repeat, index_key)
value type : Random (min, max)
image type : Tiled (…, stamp_size, xborder, yborder)
stamp : draw_method (fft or phot)
stamp : gsparams
output : file_name with .gz, .bz2 or .fz extension automatically uses compression.
Demo 8¶
In this demo, we show how to run the GalSim config processing using a python dict rather than using a config file. The previous demos have shown what Python code corresponds to the given YAML files. Now we turn the tables and show how to use some of the machinery in the GalSim configuration processing from within Python itself.
This could be useful if you want to use the config machinery to build the images, but then rather than write the images to disk, you want to keep them in memory and do further processing with them. (e.g. Run your shape measurement code on the images from within python.)
New features in the Python file:
galsim.config.Process(config, logger)
galsim.config.ProcessInput(config, logger)
galsim.config.BuildFile(config, file_num, logger)
image = galsim.config.BuildImage(config, image_num, logger)
galsim.fits.read(file_name)
New features in the YAML file:
stamp : retry_failures
shear type : Eta1Eta2 (eta1, eta2)
image : nproc
Demo 9¶
This script simulates cluster lensing or galaxy-galaxy lensing. The gravitational shear applied to each galaxy is calculated for an NFW halo mass profile. We simulate observations of galaxies around 20 different clusters – 5 each of 4 different masses. Each cluster has its own file, organized into 4 directories (one for each mass). For each cluster, we draw 20 lensed galaxies located at random positions in the image. The PSF is appropriate for a space-like simulation. (Some of the numbers used are the values for HST.) And we apply a cubic telescope distortion for the WCS. Finally, we also output a truth catalog for each output image that could be used for testing the accuracy of shape or flux measurements.
New features in the Python file:
psf = OpticalPSF(lam, diam, …, trefoil1, trefoil2, nstruts, strut_thick, strut_angle)
im = galsim.ImageS(xsize, ysize, wcs)
pos = galsim.PositionD(x, y)
nfw = galsim.NFWHalo(mass, conc, z, omega_m, omega_lam)
g1,g2 = nfw.getShear(pos, z)
mag = nfw.getMagnification(pos, z)
distdev = galsim.DistDeviate(rng, function, x_min, x_max)
pos = bounds.true_center
wcs = galsim.UVFunction(ufunc, vfunc, xfunc, yfunc, origin)
wcs.toWorld(profile, image_pos)
wcs.makeSkyImage(image, sky_level)
image_pos = wcs.toImage(pos)
image.invertSelf()
truth_cat = galsim.OutputCatalog(names, types)
bounds.isDefined()
Make multiple output files.
Place galaxies at random positions on a larger image.
Write a bad pixel mask and a weight image as the second and third HDUs in each file.
Use multiple processes to construct each file in parallel.
New features in the YAML file:
obj type : OpticalPSF (lam, diam, …, trefoil1, trefoil2, nstruts, strut_thick, strut_angle)
obj type : InclinedExponential (scale_radius, scale_h_over_r, inclination)
angle type : Radians
shear type : NFWHaloShear (redshift)
float type : NFWHaloMagnification (redshift)
float type : RandomDistribution(function, x_min, x_max)
input : nfw_halo (mass, conc, redshift)
shear type : Sum (items)
image type : Scattered (size, nobjects)
wcs type : UVFunction (ufunc, vfunc, xfunc, yfunc, origin)
str type : NumberedFile (root, num, ext, digits)
str type : FormattedStr (format, items)
pos type : RandomCircle (…, inner_radius)
value type : Sequence (…, nitems)
output : nproc
output : weight
output : badpix
output : truth
output : skip
output : noclobber
Demo 10¶
This script uses both a variable PSF and variable shear, taken from a power spectrum, along the lines of a Great10 (Kitching, et al, 2012) image. The galaxies are placed on a grid (10 x 10 in this case, rather than 100 x 100 in the interest of time.) Each postage stamp is 48 x 48 pixels. Instead of putting the PSF images on a separate image, we package them as the second HDU in the file. For the galaxies, we use a random selection from 5 specific RealGalaxy objects, selected to be 5 particularly irregular ones. (These are taken from the same catalog of 100 objects that demo6 used.) The galaxies are oriented in a ring test (Nakajima & Bernstein 2007) of 20 each. And we again output a truth catalog with the correct applied shear for each object (among other information).
New features in the Python file:
im.wcs = galsim.OffsetWCS(scale, origin)
rng = galsim.BaseDeviate(seed)
obj = galsim.RealGalaxy(real_galaxy_catalog, id)
obj = galsim.Convolve([list], real_space)
ps = galsim.PowerSpectrum(e_power_function, b_power_function)
g1,g2 = ps.buildGrid(grid_spacing, ngrid, rng)
g1,g2 = ps.getShear(pos)
galsim.random.permute(rng, list1, list2, …)
Choosing PSF parameters as a function of (x,y)
Selecting RealGalaxy by ID rather than index.
Putting the PSF image in a second HDU in the same file as the main image.
Using PowerSpectrum for the applied shear.
Doing a full ring test (i.e. not just 90 degree rotated pairs)
New features in the YAML file:
obj type : Ring (…, full_rotation)
obj type : RealGalaxy (…, id)
type : Eval using world_pos variable, user-defined variables and math functions
type : Current
shear_value : PowerSpectrumShear
pos_value : RTheta (r, theta)
image type : Tiled (…, order)
input : power_spectrum (e_power_function, b_power_function)
output.psf : hdu, signal_to_noise, draw_method, offset
output.truth : hdu
Evaluated values in output.truth.columns
Demo 11¶
This script uses a constant PSF from real data (an image read in from a bzipped FITS file, not a parametric model) and variable shear and magnification according to some cosmological model for which we have a tabulated shear power spectrum at specific k values only. The 288 galaxies in the 0.1 x 0.1 degree field (representing a number density of 8/arcmin^2) are randomly located and permitted to overlap. For the galaxies, we use a mix of real and parametric galaxies modeled off the COSMOS observations with the Hubble Space Telescope. The real galaxies are similar to those used in demo10. The parametric galaxies are based on parametric fits to the same observed galaxies. The flux and size distribution are thus realistic for an I < 23.5 magnitude limited sample.
New features in the Python file:
coord = galsim.CelestialCoord(ra, dec)
wcs = galsim.AffineTransform(dudx, dudy, dvdx, dvdy, origin)
wcs = galsim.TanWCS(affine, world_origin, units)
psf = galsim.InterpolatedImage(psf_filename, scale, flux)
tab = galsim.LookupTable(file)
cosmos_cat = galsim.COSMOSCatalog(file_name, dir)
gal = cosmos_cat.makeGalaxy(gal_type, rng, noise_pad_size)
ps = galsim.PowerSpectrum(…, units)
gal = gal.lens(g1, g2, mu)
image.whitenNoise(correlated_noise)
image.symmetrizeNoise(correlated_noise)
vn = galsim.VariableGaussianNoise(rng, var_image)
image.addNoise(cn)
image.setOrigin(x,y)
angle.dms(), angle.hms()
Power spectrum shears and magnifications for non-gridded positions.
Reading a compressed FITS image (using BZip2 compression).
Writing a compressed FITS image (using Rice compression).
Writing WCS information to a FITS header that ds9 reads as RA, Dec
New features in the YAML file:
obj type : InterpolatedImage(image, scale)
obj type : COSMOSGalaxy
obj : scale_flus
image : draw_method (no_pixel)
input : power_spectrum (e_power_file, delta2, units)
input : cosmos_catalog (file_name, dir, use_real)
image : index_convention
image.noise : whiten
image.noise : symmetrize
wcs type : Tan(dudx, dudy, dvdx, dvdy, units, origin, ra, dec)
top level field eval_variables
Power spectrum shears and magnifications for non-gridded positions.
Reading a compressed FITS image (using BZip2 compression).
Writing a compressed FITS image (using Rice compression).
Using $ as a shorthand for Eval type.
Demo 12¶
This demo introduces wavelength-dependent profiles. Three kinds of chromatic profiles are demonstrated:
A chromatic object representing a DeVaucouleurs galaxy with an early-type SED at redshift 0.8. This galaxy is drawn using the six LSST filters, which demonstrate that the galaxy is a g-band dropout.
A two-component bulge+disk galaxy, in which the bulge and disk have different SEDs.
A wavelength-dependent atmospheric PSF, which includes the effect of differential chromatic refraction and the wavelength dependence of Kolmogorov-turbulence-induced seeing. This PSF is convolved with a simple Exponential galaxy.
New features in the Python file:
SED = galsim.SED(wave, flambda, wave_type, flux_type)
SED2 = SED.atRedshift(redshift)
bandpass = galsim.Bandpass(filename, wave_type)
bandpass2 = bandpass.truncate(relative_throughput)
bandpass3 = bandpass2.thin(rel_err)
gal = GSObject * SED
obj = galsim.Add([list of ChromaticObjects])
ChromaticObject.drawImage(bandpass)
PSF = galsim.ChromaticAtmosphere(GSObject, base_wavelength, zenith_angle)
New features in the YAML file:
- sedfile_name, wave_type, flux_type, norm_flux_density, norm_wavelength,
norm_flux, norm_bandpass
bandpass : filename, wave_type, thin
gal : redshift
psf_type : ChromaticAtmosphere (base_profile, base_wavelength, latitude, HA)
Demo 13¶
This script is intended to produce a relatively realistic scene of galaxies and stars as will be observed by the Roman Space Telescope, including the Roman PSF, WCS, and various NIR detector effects.
It introduces several non-idealities arising from NIR detectors, in particular those that will be observed and accounted for in the Roman Space Telescope. Three such non-ideal effects are demonstrated, in the order in which they are introduced in the detectors:
Reciprocity failure: Flux-dependent sensitivity of the detector.
Non-linearity: Charge-dependent gain in converting from units of electrons to ADU. Non-linearity in some form is also relevant for CCDs in addition to NIR detectors.
Interpixel capacitance: Influence of charge in a pixel on the voltage reading of neighboring ones.
It also uses chromatic photon shooting, which is generally a more efficient way to simulate scenes with many faint galaxies. The default FFT method for drawing chromatically is fairly slow, since it needs to integrate the image over the bandpass. With photon shooting, the photons are assigned wavelengths according to the SED of the galaxy, and then each photon has the appropriate application of the chromatic PSF according to the wavelength.
New features in the Python file:
image.quantize()
obj = galsim.DeltaFunction(flux)
galsim.roman.addReciprocityFailure(image)
galsim.roman.applyNonlinearity(image)
galsim.roman.applyIPC(image)
galsim.roman.getBandpasses()
galsim.roman.getPSF()
galsim.roman.getWCS()
galsim.roman.allowedPos()
galsim.roman.getSkyLevel()
New features in the YAML file:
Top-level field modules
obj type: RomanPSF
image type: RomanSCA
draw_method=phot in conjunction with chromatic objects
Multiple random seeds (particular so one can repeat the same values for multiple images)
rng_num specification in various fields
Multiple inputs of the same type. Use num to specify which item in the list to use each time.
Advanced Simulations¶
Great3 Simulations¶
In the directory GalSim/examples/great3
,
there are YAML config files that perform essentially the same
simulations that were done for Great3. The config apparatus had not matured sufficiently by the
time the Great3 sims were run, so these are not what the Great3 team used. However, the files
in this directory produce essentially equivalent simulations as those used in Great3.
So far there are only config files for the cgc and rgc branches of Great3, but we plan to add the files for the other branches (Issue #699).
Significant features in these files:
template option to load another config file and then modify a few aspects of it. (e.g.
rgc.yaml
)template option to load only a particular field from another config file. (e.g.
cgc_psf.yaml
)stamp.reject
custom value type (e.g. Great3Reject in
cgc.yaml
)custom extra output type (e.g. noise_free in
cgc.yaml
)top-level module field
use of ‘$’ and ‘@’ shorthand in Eval items.
DES Simulations¶
In the directory examples/des
,
there are YAML config files that showcase some of the classes
defined in the galsim.des
module. These are mostly gratuitous demos designed to showcase
various features, although meds.yaml
is very close to a real simulation we actually used in DES for testing shear measurements.
Significant features in these files:
top-level module field
special object types from galsim.des module (e.g. DES_Shapelet and DES_PSFEx in
draw_psf.yaml
)special output type from galsim.des module (e.g. MEDS in
meds.yaml
)custom value type (e.g. HSM_Shape_Measure in meds.yaml, LogNormal in
blend.yaml
)custom WCS type (e.g. DES_Local in
meds.yaml
)custom input type (e.g. des_wcs in
meds.yaml
)custom stamp types (e.g. Blend in blend.yaml and BlendSet in
blendset.yaml
)custom extra output type (e.g. deblend in
blend.yaml
)


An interactive project where you use processing to generate spiral patterns.
The initial code without external controls
I saw a tutorial regarding generative design and they were making a spiral generator so I tried out the coding exercise. However, they were using mouseX as the way to interact with the spiral's form. It did not feel that intuitive for me hence I started to wonder if I could use the potentiometer and other controls to make a spiral pattern generator that I can reuse as a background for my visual designs.
Original Code
I was deciding whether I should replace the mouseX or the "2500" variable. I initially started by replacing mouseX with the serialnumber coming from the Potentiometer
I found out that replacing mouseX still made the spiral move but it also reponded to the rotation interaction from the potentiometer. However, I wanted to control the motion entirely hence I multiplied the potentiometer output with the wave variable.
I added 4 more controls so that I can adjust the color of the yellow stroke using HSB color mode. I also added a button to trigger noLoop() so that it will stop the spiral. I wanted to be able to screen capture the image. However, I wanted the button to resume the loop but it did not work.
I added one more button. Once the button is pressed, it will allow the HSB potentiometers to be used to control the other stroke that was initially white. This way, you can customise the spiral to any colors you choose. I was initially confused on how to set this up. But using if statement and more variables, I was able to make it possible.
I also changed my noLoop() function to saveFrame. This lets me save my processing image. However, there seems to be an issue capturing. It saves the file but it is blank.
I drew this before thinking of adding more controls but I knew from playing with the controls on the bread board that the controls have to be spaced out on the left and right. This is so both hands can be used simultaneously to control it at ease. The controls can't block another hence only by aligning vertically can it work.
Initially, I thought that I will have a smaller box but my bread board did not fit. So I had to use a bigger box. Luckily, I had one lying around that was perfect. Thought I had to take out all the controllers and figure out how to rewire them with female to male pins. Some even needed extensions like the button pins.
Originally I thought design system was mainly a way of saving time to make multiple screens. I thought it only apply to UX Design but reading this made me realise it applies to graphic design and other design fields too. It also made me realise design systems are made to get designers to consider the future rather than just focusing on the present. Not just for the sake of efficiency though it helps too.
Before, I had the assumption that good designers have natural aesthetic sense but after a few years of designing and seeing my design improve I learnt that design is a process of trial and error. The more you try, the better you get as you build a library of what works and what don't.
I didn't learn about grid system till recently. I used to think it was limiting but the more I use it the more I realise how it does improve our aesthetics overall. Learning coding also made me realise why grid systems are necessary and the art of good design is to balance functionality, logic and aesthetics rather than just one if we want to create sustainable designs (which should be our top priority as interaction designers.)


The page you're looking for either doesn't exist anymore or has changed URLs.
While you're here, let me welcome you to my personal website. You can find out more about me and my work on the home page.


A 4D free-fly spin coaster that lifts riders 120 feet straight up before releasing a car that winds and flips its way at least six times through the twisted track. Similar to “Batman: The Ride” that debuted at Six Flags Fiesta Texas in 2015, The Joker opened Memorial Day Weekend—but not before experiencing a few glitches. During a preview of the ride Thursday, a few unwitting testers were left hanging upside down after the ride malfunctioned. Brave enough to try it out anyway?
Learn MoreEnjoy the bone-rattling vibrations of a classic wooden coaster? Dollywood’s Lightning Rod will be the world’s fastest wooden roller coaster clocking in speeds of up to 73 mph. Themed after tricked out hot rods of the 1950s, Lightning Rod will be the first wooden roller coaster ever to hit 45 mph at the top of its first lift hill. The ride was originally slated to open this spring but its preview date has been pushed back to later this summer.
Learn MoreBilled as the tallest, fastest, and longest roller coaster in Orlando, SeaWorld’s Mako soars 200 feet in the air, reaching speeds over 73 mph over nearly a mile of track. Named for one of the fastest sharks in the ocean, Mako tries to educate riders about the species with educational videos throughout the queue hosted by marine biologist and wildlife artist Guy Harvey. Mako is scheduled to open on June 10. Can’t wait that long? SeaWorld is auctioning off seats on a June 8 preview ride for the charity Give Kids The World.
Learn More


?**
PU
6-
II-,7
FLORA
of
THE
ISLAND
OF
DOMINICA
British
West
Indies
212
Panicum
pilosum
Swartz
road
leading
into
estate
house
altitude
7
m.,
(rainfall
381
cm.)
Lisdara
Walter
H.
Hodge
August
87-31,
19S8
Ib04fib7
1604867
Legend -
Level of confidence that token is an accurately-transcribed word
extremely low
very low
low
undetermined
medium
high
very high


The idwt() function reconstructs data from the given coefficients by performing single level Inverse Discrete Wavelet Transform.
| Parameters: |
|
|---|
Example:
>>> import pywt
>>> (cA, cD) = pywt.dwt([1,2,3,4,5,6], 'db2', 'sp1')
>>> print pywt.idwt(cA, cD, 'db2', 'sp1')
[ 1. 2. 3. 4. 5. 6.]
One of the neat features of idwt() is that one of the cA and cD arguments can be set to None. In that situation the reconstruction will be performed using only the other one. Mathematically speaking, this is equivalent to passing a zero-filled array as one of the arguments.
Example:
>>> import pywt
>>> (cA, cD) = pywt.dwt([1,2,3,4,5,6], 'db2', 'sp1')
>>> A = pywt.idwt(cA, None, 'db2', 'sp1')
>>> D = pywt.idwt(None, cD, 'db2', 'sp1')
>>> print A + D
[ 1. 2. 3. 4. 5. 6.]
Performs multilevel reconstruction of signal from the given list of coefficients.
| Parameters: |
|
|---|
Example:
>>> import pywt
>>> coeffs = pywt.wavedec([1,2,3,4,5,6,7,8], 'db2', level=2)
>>> print pywt.waverec(coeffs, 'db2')
[ 1. 2. 3. 4. 5. 6. 7. 8.]
Direct reconstruction from coefficients.
| Parameters: |
|
|---|
Example:
>>> import pywt
>>> data = [1,2,3,4,5,6]
>>> (cA, cD) = pywt.dwt(data, 'db2', 'sp1')
>>> print pywt.upcoef('a', cA, 'db2') + pywt.upcoef('d', cD, 'db2')
[-0.25 -0.4330127 1. 2. 3. 4. 5.
6. 1.78589838 -1.03108891]
>>> n = len(data)
>>> print pywt.upcoef('a',cA,'db2',take=n) + pywt.upcoef('d',cD,'db2',take=n)
[ 1. 2. 3. 4. 5. 6.]


Introduction
formal semantics
compound assignment operators
The compound assignment operator hide one step of righthand side evaluation. This is where the code deviates with what’s in our mind.
implicit type conversion
prototype in object
function: prototype and constructor
destruct class statement
instanceof
return is a break


{{ $ctrl.report.acb.name }} Annual Surveillance Reporting
{{ $ctrl.report.year }}
The titles and descriptions used in this module’s user interface reflect the most recent version of the report and may appear differently for historical reports in the downloads
Please list any obstacles encountered during surveillance, including those related to resources/technical capabilities, developers, and providers/end-users.