## miércoles, 7 de septiembre de 2016

Bienvenid(a)os al curso de Sistemas Ambientales.

Mi correo ekectrónico es mundoaleatorio@yahoo.com

A lo largo del curso se publicarán las prácticas a realizar en est blog.

## viernes, 28 de junio de 2013

### SIR Models

May 14, 2013
By
(This article was first published on Econometrics by Simulation, and kindly contributed to R-bloggers)
# The SIR Model (susceptible, infected, and recovered) model is a common and useful tool in epidemiological modelling.

# In this post and in future posts I hope to explore how this basic model can be enriched by including different population groups or disease vectors.

# Simulation Population Parameters:
# Proportion Susceptible
Sp = .9

# Proportion Infected
Ip = .1

# Population
N = 1000

# Number of periods
r = 200

# Number of pieces in each time period.
# A dynamic model can be simulated by dividing each dynamic period into a sufficient number of discrete pieces.
# As the number of pieces approaches infinity then the differences between the simulated outcome and the outcome achieved by solving the dynamic equations approaches zero.
np = 1

# Model - Dynamic Change
DS = function() -B*C*S*I/N
DI = function() (B*C*S*I/N) - v*I
DZ = function() v*I
# I is the number of people infected, N the number of people in total, S is the number of people susceptible for infection, and Z is the number of people immune to the infection (from already recovering from the infection).

# Model Parameters:
# Transmition rate from contact with an infected individual.
B = .2
# Contact rate. The number of people that someone becomes in contact with sufficiently to recieve transmition.
C = .5
# Recovery rate. Meaning the average person will recover in 20 days (3 weeks).
# This would have to be a particularly virolent form of the flu (not impossible at all).
v = .05

# Initial populations:

# Sesceptible population, Sv is a vector while S is the population values as the current period
Sv = S = Sp*N

# Infected, Iv is a vector while I is the population values as the current period
Iv = I = Ip*N

# Initial immunity.
Zv = Z = 0

# Now let's how the model works.
# Loop through periods
for (p in 1:r) {
# Loop through parts of periods
for (pp in 1:np) {

# Calculate the change values
ds = DS()/np
di = DI()/np
dz = DZ()/np

# Change the total populations
S = S + ds
I = I + di
Z = Z + dz

# Save the changes in vector form
Sv = c(Sv, S)
Iv = c(Iv, I)
Zv = c(Zv, Z)
}
}

# ggplot2 generates easily high quality graphics
require(ggplot2)

# Save the data to a data frame for easy manipulation with ggplot
mydata = data.frame(Period=rep((1:length(Sv))/np,3), Population = c(Sv, Iv, Zv), Indicator=rep(c("Uninfected", "Infected", "Recovered"), each=length(Sv)))

# This sets up the plot but does not actually graph anything yet.
p &lt;- aes="" ggplot="" group="Indicator))" mydata="" nbsp="" p="" x="Period," y="Population,"&gt;
# This graphs the first plot just by the use of the p command.
# Adding the geom_line plots the lines changing the color or the plot for each indicator (population group)
p + geom_line(aes(colour = Indicator)) + ggtitle("Flu Season")

# Save initial graph:
ggsave(file="2013-05-14flu.png")

# Let's do some back of the envelope cost calculations.
# Let's say the cost of being infected with the flu is about \$10 a day (a low estimate) in terms of lost productivity as well as expenses on treatment.
# This amounts to:
sum(Iv/np)*10
# Which is a cost of \$165,663.40 over an entire flu season for the thousand people in our simulated sample.
# Or about \$165 per person.

# Imagine if we could now do a public service intervention.
# Telling people to wash their hands, practice social distancing, and avoid touching their noses and eyes, and staying at home when ill.
# Let's say people take up these practices and it reduces the number of potential exposure periods per contact by half.
C = .25

# ....

p + geom_line(aes(colour = Indicator)) + ggtitle("Flu Season with Prevention")

# Save initial graph:
ggsave(file="2013-05-14flu2.png")

# ....

sum(Iv/np)*10
# Which is a cost of \$76,331.58 over an entire flu season for the thousand people in our simulated sample or about 76 dollars per person.

# The difference in costs is about 89 thousand dollars for the whole population or on average 89 per person. The argument is therefore, so long as a public service intervention that reduces personal contact costs less than 89 thousand dollars for those 1000 people, then it is an efficient intervention (at least by the made up parameters I have here).

## miércoles, 7 de noviembre de 2012

`             `

# http://www.enn.com/top_stories/article/41915

Trees and other vegetation must use what is in their environment. So it is not surprising to find that they absorb pollutants (natural or man made) which may be absorbed successfully or may cause the vegetation to die. Vegetation plays an unexpectedly large role in cleansing the atmosphere, a new study finds. The research, led by scientists at the National Center for Atmospheric Research (NCAR) in Boulder, Colo., uses observations, gene expression studies, and computer modeling to show that deciduous plants absorb about a third more of a common class of air-polluting chemicals than previously thought.

The ways that trees can help to clean the air should not be overlooked. Trees are an important, cost-effective solution to reducing pollution and improving air quality.
Trees help to lower air temperatures and the urban heat island affect. This reduction of temperature not only lowers energy use, it also improves air quality, as the formation of ozone is dependent on temperature.
Trees also reduce pollution by actively removing it from the atmosphere. Leaf stomata, the pores on the leaf surface, take in polluting gases which are then absorbed by water inside the leaf. Some species of trees are more susceptible to the uptake of pollution, which could negatively affect plant growth. Ideally, trees should be selected that take in higher quantities of polluting gases and are resistant to the negative affects they can cause.
A study across the Chicago region determined that trees removed approximately 17 tons of carbon monoxide (CO), 93 tons of sulfur dioxide (SO2), 98 tons of nitrogen dioxide (NO2), and 210 tons of ozone in 1991.
The new study, results of which are being published this week in Science Express, was conducted with co-authors from the University of Northern Colorado and the University of Arizona.
"Plants clean our air to a greater extent than we had realized," says NCAR scientist Thomas Karl, the lead author. "They actively consume certain types of air pollution."
The research team focused on a class of chemicals known as oxygenated volatile organic compounds (oVOCs), which can have long-term impacts on the environment and human health.
"The team has made significant progress in understanding the complex interactions between plants and the atmosphere," says Anne-Marie Schmoltner of NSF's Division of Atmospheric and Geospace Sciences.
The compounds form in abundance in the atmosphere from hydrocarbons and other chemicals that are emitted from both natural sources--including plants--and sources related to human activities, including vehicles and construction materials.
Eventually, some oVOCs may evolve into tiny airborne particles, known as aerosols, that have important effects on both clouds and human health.
By measuring oVOC levels in a number of ecosystems in the United States and other countries, the researchers determined that deciduous plants appear to be taking up the compounds at an unexpectedly fast rate--as much as four times more rapidly than previously thought.
The uptake was especially rapid in dense forests and most evident near the tops of forest canopies, which accounted for as much as 97 percent of the oVOC uptake that was observed.
The scientists moved their research into their laboratories and focused on poplar trees. The species offered a significant advantage in that its genome has been sequenced.
The team found that when the study trees were under stress, either because of a physical wound or because of exposure to an irritant such as ozone pollution, they began sharply increasing their uptake of oVOCs.
At the same time, changes took place in expression levels of certain genes that indicated heightened metabolic activity in the poplars.
The uptake of oVOCs, the scientists concluded, appeared to be part of a larger metabolic cycle.
In order to metabolize these chemicals, the plants start increasing the levels of enzymes that transform the chemicals into less toxic substances.
At the same time, as it turns out, the plant draws down more oVOCs, which can be metabolized by the enzymes.
"Our results show that plants can actually adjust their metabolism and increase their uptake of atmospheric chemicals as a response to various types of stress," says Chhandak Basu of the University of Northern Colorado, a co-author.
"This complex metabolic process within plants has the side effect of cleansing our atmosphere."
Once they understood the extent to which plants absorb oVOCs, the research team fed the information into a computer model that simulates chemicals in the atmosphere worldwide.
The results indicated that, on a global level, plants are taking in 36 percent more oVOCs than had previously been accounted for in studies of atmospheric chemistry.
Additionally, since plants are directly removing the oVOCs, fewer of the compounds are evolving into aerosols.
A poet (Joyce Kilmer) once said:
"I think that I shall never see
A poem lovely as a tree.
A tree whose hungry mouth is prest
Against the earth's sweet flowing breast;"
In this case that lovely tree is eating our atmospheric poisons.

For further information: http://nsf.gov/news/news_summ.jsp?cntn_id=117919&org=NSF&from=news

## miércoles, 27 de junio de 2012

### Preguntas Frecuentes Práctica 3

¿La Práctica es individual'
R: Si
¿Fecha de entrega?
R3 de Julio