<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://eclr.humanities.manchester.ac.uk/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=JL</id>
		<title>ECLR - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://eclr.humanities.manchester.ac.uk/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=JL"/>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php/Special:Contributions/JL"/>
		<updated>2026-04-11T16:58:26Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.30.1</generator>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4086</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4086"/>
				<updated>2015-10-27T12:04:35Z</updated>
		
		<summary type="html">&lt;p&gt;JL: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
Matlab has some very powerful graphics capabilities for plotting data in many different styles. Whilst the syntax for most of the basic plotting functions is simple, the more advanced features can be quite daunting to the uninitiated. In this section we introduce some of the common plot types that you will need in your econometric analysis and presentation.&lt;br /&gt;
&lt;br /&gt;
For a complete exposition of all Matlab&amp;#039;s graphics features refer to [http://uk.mathworks.com/help/pdf_doc/matlab/graphg.pdf Matlab&amp;#039;s Graphics Guide].&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;code&amp;gt;hold all&amp;lt;/code&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to a horizontal lines for the mean and another two indicating +/- 1 standard deviation from the mean for the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
avg=mean(stocks(:));&lt;br /&gt;
sd=std(stocks(:));&lt;br /&gt;
hold all&lt;br /&gt;
plot(xlim, [avg avg],&amp;#039;-k&amp;#039;)&lt;br /&gt;
plot(xlim, [avg+sd avg+sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [avg-sd avg-sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;code&amp;gt;xlim&amp;lt;/code&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;-k&amp;#039; argument specifies the plotted line to be a solid black line, whereas the &amp;#039;--r&amp;#039; arguments specifies the plotted line as a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
In this example we use the wage data from the Wooldridge dataset &amp;#039;wages1&amp;#039;&lt;br /&gt;
[http://www.cengagebrain.com/cgi-wadsworth/course_products_wp.pl?fid=M20b&amp;amp;product_isbn_issn=9781111531041&amp;amp;token=8D04240DC39B22D05B49B265F2C8E62C6876DDE99FE979BC4A500075EC976963ED1045639B2C75C4B5B2337F07088998 Wooldridge data sets]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scatter by group, in this case on gender.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
Matlab has a number of statistical distributions, see the [[StatFunct | entry on statistical distributions]] for an introduction. We can use the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function to graph these distributions. The first thing to do is generate a vector of suitable values for the x-axis; in this example we use the &amp;lt;code&amp;gt;linspace&amp;lt;/code&amp;gt; function to create a &amp;lt;math&amp;gt;(1000 \times 1)&amp;lt;/math&amp;gt; vector of evenly spaced points between -5 and 5 on the x-axis. We then use this vector as the input to our distribution of choice (e.g. the Normal PDF) to obtain a vector of the probabilities for each corresponding x value; these will form our y-axis values in the plot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
x=linspace(-5,5,1000);&lt;br /&gt;
xnorm = normpdf(x);&lt;br /&gt;
figure&lt;br /&gt;
plot(x,xnorm,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,2)&lt;br /&gt;
title(&amp;#039;Probability density plot of standard Normal distribution&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
As before, we can add additional plots to this graph. In the next example we plot the t-distribution for increasing degrees of freedom &amp;lt;code&amp;gt;df=[1,5,10]&amp;lt;/code&amp;gt; to show how the t-distribution approximates to the Normal distribution as the degrees of freedom increases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hold all&lt;br /&gt;
df = [1,5,10];&lt;br /&gt;
for ii=1:length(df)&lt;br /&gt;
    xt = tpdf(x,df(ii));&lt;br /&gt;
    plot(x,xt)&lt;br /&gt;
end&lt;br /&gt;
title(&amp;#039;Comparing t-distributions with standard Normal&amp;#039;)&lt;br /&gt;
legend(&amp;#039;Normal&amp;#039;,&amp;#039;T-dist df=1&amp;#039;,&amp;#039;T-dist df=5&amp;#039;,&amp;#039;T-dist df=10&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot2.png]]&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;br /&gt;
&lt;br /&gt;
Kernel Density estimation is a way to estimate the probability density function of a random variable from a sample of data. Returning to the stock market values data used above we can fit a PDF to this data using the &amp;lt;code&amp;gt;ksdensity&amp;lt;/code&amp;gt; function. We input our observations and the function will return two outputs, &amp;lt;code&amp;gt;xi&amp;lt;/code&amp;gt;, a vector of x-coordinates at which the density was evaluated and &amp;lt;code&amp;gt;fi&amp;lt;/code&amp;gt; a corresponding vector of densities. We can then use these outputs to produce a nice plot as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
[f,xi] = ksdensity(stocks(:));&lt;br /&gt;
plot(xi,f,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,1.5)&lt;br /&gt;
title(&amp;#039;Kernel density plot of stock market returns&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:KernelPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
Here the &amp;lt;code&amp;gt;ksdensity&amp;lt;/code&amp;gt; chose the values at which to evaluate the density itself. If you were planning to compare this to a different distribution, i.e. one of the theoretical distributions discussed above, you could also force the function to evaluate the density at the same x-coordinates by calling &amp;lt;code&amp;gt;ksdensity(stocks(:),x)&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; is defined as above.&lt;br /&gt;
&lt;br /&gt;
= Saving Plots =&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4085</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4085"/>
				<updated>2015-10-27T11:57:04Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Scatter Diagrams */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
Matlab has some very powerful graphics capabilities for plotting data in many different styles. Whilst the syntax for most of the basic plotting functions is simple, the more advanced features can be quite daunting to the uninitiated. In this section we introduce some of the common plot types that you will need in your econometric analysis and presentation.&lt;br /&gt;
&lt;br /&gt;
For a complete exposition of all Matlab&amp;#039;s graphics features refer to [http://uk.mathworks.com/help/pdf_doc/matlab/graphg.pdf Matlab&amp;#039;s Graphics Guide].&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;code&amp;gt;hold all&amp;lt;/code&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to a horizontal lines for the mean and another two indicating +/- 1 standard deviation from the mean for the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
avg=mean(stocks(:));&lt;br /&gt;
sd=std(stocks(:));&lt;br /&gt;
hold all&lt;br /&gt;
plot(xlim, [avg avg],&amp;#039;-k&amp;#039;)&lt;br /&gt;
plot(xlim, [avg+sd avg+sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [avg-sd avg-sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;code&amp;gt;xlim&amp;lt;/code&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;-k&amp;#039; argument specifies the plotted line to be a solid black line, whereas the &amp;#039;--r&amp;#039; arguments specifies the plotted line as a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
In this example we use the wage data from the Wooldridge dataset &amp;#039;wages1&amp;#039;&lt;br /&gt;
[http://www.cengagebrain.com/cgi-wadsworth/course_products_wp.pl?fid=M20b&amp;amp;product_isbn_issn=9781111531041&amp;amp;token=8D04240DC39B22D05B49B265F2C8E62C6876DDE99FE979BC4A500075EC976963ED1045639B2C75C4B5B2337F07088998 Wooldridge data sets]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scatter by group, in this case on gender.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
Matlab has a number of statistical distributions, see the [[StatFunct | entry on statistical distributions]] for an introduction. We can use the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function to graph these distributions. The first thing to do is generate a vector of suitable values for the x-axis; in this example we use the &amp;lt;code&amp;gt;linspace&amp;lt;/code&amp;gt; function to create a &amp;lt;math&amp;gt;(1000 \times 1)&amp;lt;/math&amp;gt; vector of evenly spaced points between -5 and 5 on the x-axis. We then use this vector as the input to our distribution of choice (e.g. the Normal PDF) to obtain a vector of the probabilities for each corresponding x value; these will form our y-axis values in the plot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
x=linspace(-5,5,1000);&lt;br /&gt;
xnorm = normpdf(x);&lt;br /&gt;
figure&lt;br /&gt;
plot(x,xnorm,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,2)&lt;br /&gt;
title(&amp;#039;Probability density plot of standard Normal distribution&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
As before, we can add additional plots to this graph. In the next example we plot the t-distribution for increasing degrees of freedom &amp;lt;code&amp;gt;df=[1,5,10]&amp;lt;/code&amp;gt; to show how the t-distribution approximates to the Normal distribution as the degrees of freedom increases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hold all&lt;br /&gt;
df = [1,5,10];&lt;br /&gt;
for ii=1:length(df)&lt;br /&gt;
    xt = tpdf(x,df(ii));&lt;br /&gt;
    plot(x,xt)&lt;br /&gt;
end&lt;br /&gt;
title(&amp;#039;Comparing t-distributions with standard Normal&amp;#039;)&lt;br /&gt;
legend(&amp;#039;Normal&amp;#039;,&amp;#039;T-dist df=1&amp;#039;,&amp;#039;T-dist df=5&amp;#039;,&amp;#039;T-dist df=10&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot2.png]]&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;br /&gt;
&lt;br /&gt;
Kernel Density estimation is a way to estimate the probability density function of a random variable from a sample of data. Returning to the stock market values data used above we can fit a PDF to this data using the &amp;lt;code&amp;gt;ksdensity&amp;lt;/code&amp;gt; function. We input our observations and the function will return two outputs, &amp;lt;code&amp;gt;xi&amp;lt;/code&amp;gt;, a vector of x-coordinates at which the density was evaluated and &amp;lt;code&amp;gt;fi&amp;lt;/code&amp;gt; a corresponding vector of densities. We can then use these outputs to produce a nice plot as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
[f,xi] = ksdensity(stocks(:));&lt;br /&gt;
plot(xi,f,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,1.5)&lt;br /&gt;
title(&amp;#039;Kernel density plot of stock market returns&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:KernelPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
Here the &amp;lt;code&amp;gt;ksdensity&amp;lt;/code&amp;gt; chose the values at which to evaluate the density itself. If you were planning to compare this to a different distribution, i.e. one of the theoretical distributions discussed above, you could also force the function to evaluate the density at the same x-coordinates by calling &amp;lt;code&amp;gt;ksdensity(stocks(:),x)&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; is defined as above.&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4084</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4084"/>
				<updated>2015-10-27T11:54:58Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Line Plots */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
Matlab has some very powerful graphics capabilities for plotting data in many different styles. Whilst the syntax for most of the basic plotting functions is simple, the more advanced features can be quite daunting to the uninitiated. In this section we introduce some of the common plot types that you will need in your econometric analysis and presentation.&lt;br /&gt;
&lt;br /&gt;
For a complete exposition of all Matlab&amp;#039;s graphics features refer to [http://uk.mathworks.com/help/pdf_doc/matlab/graphg.pdf Matlab&amp;#039;s Graphics Guide].&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;code&amp;gt;hold all&amp;lt;/code&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to a horizontal lines for the mean and another two indicating +/- 1 standard deviation from the mean for the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
avg=mean(stocks(:));&lt;br /&gt;
sd=std(stocks(:));&lt;br /&gt;
hold all&lt;br /&gt;
plot(xlim, [avg avg],&amp;#039;-k&amp;#039;)&lt;br /&gt;
plot(xlim, [avg+sd avg+sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [avg-sd avg-sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;code&amp;gt;xlim&amp;lt;/code&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;-k&amp;#039; argument specifies the plotted line to be a solid black line, whereas the &amp;#039;--r&amp;#039; arguments specifies the plotted line as a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
In this example we use the wage data from the Wooldridge dataset &amp;#039;wages1&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scatter by group, in this case on gender.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
Matlab has a number of statistical distributions, see the [[StatFunct | entry on statistical distributions]] for an introduction. We can use the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function to graph these distributions. The first thing to do is generate a vector of suitable values for the x-axis; in this example we use the &amp;lt;code&amp;gt;linspace&amp;lt;/code&amp;gt; function to create a &amp;lt;math&amp;gt;(1000 \times 1)&amp;lt;/math&amp;gt; vector of evenly spaced points between -5 and 5 on the x-axis. We then use this vector as the input to our distribution of choice (e.g. the Normal PDF) to obtain a vector of the probabilities for each corresponding x value; these will form our y-axis values in the plot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
x=linspace(-5,5,1000);&lt;br /&gt;
xnorm = normpdf(x);&lt;br /&gt;
figure&lt;br /&gt;
plot(x,xnorm,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,2)&lt;br /&gt;
title(&amp;#039;Probability density plot of standard Normal distribution&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
As before, we can add additional plots to this graph. In the next example we plot the t-distribution for increasing degrees of freedom &amp;lt;code&amp;gt;df=[1,5,10]&amp;lt;/code&amp;gt; to show how the t-distribution approximates to the Normal distribution as the degrees of freedom increases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hold all&lt;br /&gt;
df = [1,5,10];&lt;br /&gt;
for ii=1:length(df)&lt;br /&gt;
    xt = tpdf(x,df(ii));&lt;br /&gt;
    plot(x,xt)&lt;br /&gt;
end&lt;br /&gt;
title(&amp;#039;Comparing t-distributions with standard Normal&amp;#039;)&lt;br /&gt;
legend(&amp;#039;Normal&amp;#039;,&amp;#039;T-dist df=1&amp;#039;,&amp;#039;T-dist df=5&amp;#039;,&amp;#039;T-dist df=10&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot2.png]]&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;br /&gt;
&lt;br /&gt;
Kernel Density estimation is a way to estimate the probability density function of a random variable from a sample of data. Returning to the stock market values data used above we can fit a PDF to this data using the &amp;lt;code&amp;gt;ksdensity&amp;lt;/code&amp;gt; function. We input our observations and the function will return two outputs, &amp;lt;code&amp;gt;xi&amp;lt;/code&amp;gt;, a vector of x-coordinates at which the density was evaluated and &amp;lt;code&amp;gt;fi&amp;lt;/code&amp;gt; a corresponding vector of densities. We can then use these outputs to produce a nice plot as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
[f,xi] = ksdensity(stocks(:));&lt;br /&gt;
plot(xi,f,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,1.5)&lt;br /&gt;
title(&amp;#039;Kernel density plot of stock market returns&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:KernelPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
Here the &amp;lt;code&amp;gt;ksdensity&amp;lt;/code&amp;gt; chose the values at which to evaluate the density itself. If you were planning to compare this to a different distribution, i.e. one of the theoretical distributions discussed above, you could also force the function to evaluate the density at the same x-coordinates by calling &amp;lt;code&amp;gt;ksdensity(stocks(:),x)&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; is defined as above.&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4081</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4081"/>
				<updated>2015-10-25T19:47:04Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Theoretical Distributions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
Matlab has some very powerful graphics capabilities for plotting data in many different styles. Whilst the syntax for most of the basic plotting functions is simple, the more advanced features can be quite daunting to the uninitiated. In this section we introduce some of the common plot types that you will need in your econometric analysis and presentation.&lt;br /&gt;
&lt;br /&gt;
For a complete exposition of all Matlab&amp;#039;s graphics features refer to [http://uk.mathworks.com/help/pdf_doc/matlab/graphg.pdf Matlab&amp;#039;s Graphics Guide].&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;code&amp;gt;hold on&amp;lt;/code&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to a horizontal lines for the mean and another two indicating +/- 1 standard deviation from the mean for the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
avg=mean(stocks(:));&lt;br /&gt;
sd=std(stocks(:));&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [avg avg],&amp;#039;-k&amp;#039;)&lt;br /&gt;
plot(xlim, [avg+sd avg+sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [avg-sd avg-sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;code&amp;gt;xlim&amp;lt;/code&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;-k&amp;#039; argument specifies the plotted line to be a solid black line, whereas the &amp;#039;--r&amp;#039; arguments specifies the plotted line as a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
In this example we use the wage data from the Wooldridge dataset &amp;#039;wages1&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scatter by group, in this case on gender.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
Matlab has a number of statistical distributions, see the [[StatFunct | entry on statistical distributions]] for an introduction. We can use the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function to graph these distributions. The first thing to do is generate a vector of suitable values for the x-axis; in this example we use the &amp;lt;code&amp;gt;linspace&amp;lt;/code&amp;gt; function to create a &amp;lt;math&amp;gt;(1000 \times 1)&amp;lt;/math&amp;gt; vector of evenly spaced points on the x-axis. We then use this vector as the input to our distribution of choice (e.g. the Normal PDF) to obtain a vector of the probabilities for each corresponding x value; these will form our y-axis values in the plot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
x=linspace(-5,5,1000);&lt;br /&gt;
xnorm = normpdf(x);&lt;br /&gt;
figure&lt;br /&gt;
plot(x,xnorm,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,2)&lt;br /&gt;
title(&amp;#039;Probability density plot of standard Normal distribution&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
As before, we can add additional plots to this graph. In the next example we plot the t-distribution for increasing degrees of freedom &amp;lt;code&amp;gt;df=[1,5,10]&amp;lt;/code&amp;gt; to show how the t-distribution approximates to the Normal distribution as the degrees of freedom increases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hold all&lt;br /&gt;
df = [1,5,10];&lt;br /&gt;
for ii=1:length(df)&lt;br /&gt;
    xt = tpdf(x,df(ii));&lt;br /&gt;
    plot(x,xt)&lt;br /&gt;
end&lt;br /&gt;
title(&amp;#039;Comparing t-distributions with standard Normal&amp;#039;)&lt;br /&gt;
legend(&amp;#039;Normal&amp;#039;,&amp;#039;T-dist df=1&amp;#039;,&amp;#039;T-dist df=5&amp;#039;,&amp;#039;T-dist df=10&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot2.png]]&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;br /&gt;
&lt;br /&gt;
Kernel Density estimation is a way to estimate the probability density function of a random variable from a sample of data. Returning to the stock market values data used above we can fit a PDF to this data using the &amp;lt;code&amp;gt;ksdensity&amp;lt;/code&amp;gt; function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
[f,xi] = ksdensity(stocks(:));&lt;br /&gt;
plot(xi,f,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,1.5)&lt;br /&gt;
title(&amp;#039;Kernel density plot of stock market returns&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:KernelPlot1.png]]&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4080</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4080"/>
				<updated>2015-10-25T19:46:37Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Theoretical Distributions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
Matlab has some very powerful graphics capabilities for plotting data in many different styles. Whilst the syntax for most of the basic plotting functions is simple, the more advanced features can be quite daunting to the uninitiated. In this section we introduce some of the common plot types that you will need in your econometric analysis and presentation.&lt;br /&gt;
&lt;br /&gt;
For a complete exposition of all Matlab&amp;#039;s graphics features refer to [http://uk.mathworks.com/help/pdf_doc/matlab/graphg.pdf Matlab&amp;#039;s Graphics Guide].&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;code&amp;gt;hold on&amp;lt;/code&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to a horizontal lines for the mean and another two indicating +/- 1 standard deviation from the mean for the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
avg=mean(stocks(:));&lt;br /&gt;
sd=std(stocks(:));&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [avg avg],&amp;#039;-k&amp;#039;)&lt;br /&gt;
plot(xlim, [avg+sd avg+sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [avg-sd avg-sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;code&amp;gt;xlim&amp;lt;/code&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;-k&amp;#039; argument specifies the plotted line to be a solid black line, whereas the &amp;#039;--r&amp;#039; arguments specifies the plotted line as a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
In this example we use the wage data from the Wooldridge dataset &amp;#039;wages1&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scatter by group, in this case on gender.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
Matlab has a number of statistical distributions, see the [[StatFunct | entry on statistical distributions]] for an introduction. We can use the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function to graph these distributions. The first thing to do is generate a vector of suitable values for the x-axis; in this example we use the &amp;lt;code&amp;gt;linspace&amp;lt;/code&amp;gt; function to create a &amp;lt;math&amp;gt;(1000 \times 1)&amp;lt;/math&amp;gt; vector of evenly spaced points on the x-axis. We then use this vector as the input to out distribution of choice (e.g. the Normal PDF) to obtain a vector of the probabilities for each corresponding x value; these will form our y-axis values in the plot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
x=linspace(-5,5,1000);&lt;br /&gt;
xnorm = normpdf(x);&lt;br /&gt;
figure&lt;br /&gt;
plot(x,xnorm,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,2)&lt;br /&gt;
title(&amp;#039;Probability density plot of standard Normal distribution&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
As before, we can add additional plots to this graph. In the next example we plot the t-distribution for increasing degrees of freedom &amp;lt;code&amp;gt;df=[1,5,10]&amp;lt;/code&amp;gt; to show how the t-distribution approximates to the Normal distribution as the degrees of freedom increases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hold all&lt;br /&gt;
df = [1,5,10];&lt;br /&gt;
for ii=1:length(df)&lt;br /&gt;
    xt = tpdf(x,df(ii));&lt;br /&gt;
    plot(x,xt)&lt;br /&gt;
end&lt;br /&gt;
title(&amp;#039;Comparing t-distributions with standard Normal&amp;#039;)&lt;br /&gt;
legend(&amp;#039;Normal&amp;#039;,&amp;#039;T-dist df=1&amp;#039;,&amp;#039;T-dist df=5&amp;#039;,&amp;#039;T-dist df=10&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot2.png]]&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;br /&gt;
&lt;br /&gt;
Kernel Density estimation is a way to estimate the probability density function of a random variable from a sample of data. Returning to the stock market values data used above we can fit a PDF to this data using the &amp;lt;code&amp;gt;ksdensity&amp;lt;/code&amp;gt; function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
[f,xi] = ksdensity(stocks(:));&lt;br /&gt;
plot(xi,f,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,1.5)&lt;br /&gt;
title(&amp;#039;Kernel density plot of stock market returns&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:KernelPlot1.png]]&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4079</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4079"/>
				<updated>2015-10-25T19:44:56Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Theoretical Distributions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
Matlab has some very powerful graphics capabilities for plotting data in many different styles. Whilst the syntax for most of the basic plotting functions is simple, the more advanced features can be quite daunting to the uninitiated. In this section we introduce some of the common plot types that you will need in your econometric analysis and presentation.&lt;br /&gt;
&lt;br /&gt;
For a complete exposition of all Matlab&amp;#039;s graphics features refer to [http://uk.mathworks.com/help/pdf_doc/matlab/graphg.pdf Matlab&amp;#039;s Graphics Guide].&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;code&amp;gt;hold on&amp;lt;/code&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to a horizontal lines for the mean and another two indicating +/- 1 standard deviation from the mean for the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
avg=mean(stocks(:));&lt;br /&gt;
sd=std(stocks(:));&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [avg avg],&amp;#039;-k&amp;#039;)&lt;br /&gt;
plot(xlim, [avg+sd avg+sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [avg-sd avg-sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;code&amp;gt;xlim&amp;lt;/code&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;-k&amp;#039; argument specifies the plotted line to be a solid black line, whereas the &amp;#039;--r&amp;#039; arguments specifies the plotted line as a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
In this example we use the wage data from the Wooldridge dataset &amp;#039;wages1&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scatter by group, in this case on gender.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
Matlab has a number of statistical distributions, see the [[StatFunct | entry on statistical distributions]] for an introduction. We can use the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function to graph these distributions. The first thing to do is generate a vector of suitable values for the x-axis; in this example we use the &amp;lt;code&amp;gt;linspace&amp;lt;/code&amp;gt; function to create a (1000 x 1) vector of evenly spaced points on the x-axis. We then use this vector as the input to out distribution of choice (e.g. the Normal PDF) to obtain a vector of the probabilities for each corresponding x value; these will form our y-axis values in the plot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
x=linspace(-5,5,1000);&lt;br /&gt;
xnorm = normpdf(x);&lt;br /&gt;
figure&lt;br /&gt;
plot(x,xnorm,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,2)&lt;br /&gt;
title(&amp;#039;Probability density plot of standard Normal distribution&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
As before, we can add additional plots to this graph. In the next example we plot the t-distribution for increasing degrees of freedom &amp;lt;code&amp;gt;df=[1,5,10]&amp;lt;/code&amp;gt; to show how the t-distribution approximates to the Normal distribution as the degrees of freedom increases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hold all&lt;br /&gt;
df = [1,5,10];&lt;br /&gt;
for ii=1:length(df)&lt;br /&gt;
    xt = tpdf(x,df(ii));&lt;br /&gt;
    plot(x,xt)&lt;br /&gt;
end&lt;br /&gt;
title(&amp;#039;Comparing t-distributions with standard Normal&amp;#039;)&lt;br /&gt;
legend(&amp;#039;Normal&amp;#039;,&amp;#039;T-dist df=1&amp;#039;,&amp;#039;T-dist df=5&amp;#039;,&amp;#039;T-dist df=10&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot2.png]]&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;br /&gt;
&lt;br /&gt;
Kernel Density estimation is a way to estimate the probability density function of a random variable from a sample of data. Returning to the stock market values data used above we can fit a PDF to this data using the &amp;lt;code&amp;gt;ksdensity&amp;lt;/code&amp;gt; function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
[f,xi] = ksdensity(stocks(:));&lt;br /&gt;
plot(xi,f,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,1.5)&lt;br /&gt;
title(&amp;#039;Kernel density plot of stock market returns&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:KernelPlot1.png]]&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4078</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4078"/>
				<updated>2015-10-25T19:41:34Z</updated>
		
		<summary type="html">&lt;p&gt;JL: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
Matlab has some very powerful graphics capabilities for plotting data in many different styles. Whilst the syntax for most of the basic plotting functions is simple, the more advanced features can be quite daunting to the uninitiated. In this section we introduce some of the common plot types that you will need in your econometric analysis and presentation.&lt;br /&gt;
&lt;br /&gt;
For a complete exposition of all Matlab&amp;#039;s graphics features refer to [http://uk.mathworks.com/help/pdf_doc/matlab/graphg.pdf Matlab&amp;#039;s Graphics Guide].&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;code&amp;gt;hold on&amp;lt;/code&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to a horizontal lines for the mean and another two indicating +/- 1 standard deviation from the mean for the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
avg=mean(stocks(:));&lt;br /&gt;
sd=std(stocks(:));&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [avg avg],&amp;#039;-k&amp;#039;)&lt;br /&gt;
plot(xlim, [avg+sd avg+sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [avg-sd avg-sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;code&amp;gt;xlim&amp;lt;/code&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;-k&amp;#039; argument specifies the plotted line to be a solid black line, whereas the &amp;#039;--r&amp;#039; arguments specifies the plotted line as a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
In this example we use the wage data from the Wooldridge dataset &amp;#039;wages1&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scatter by group, in this case on gender.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
Matlab has a number of statistical distributions, see [[StatFunct]] for an introduction. We can use the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function to graph these distributions. The first thing to do is generate a vector of suitable values for the x-axis; in this example we use the &amp;lt;code&amp;gt;linspace&amp;lt;/code&amp;gt; function to create a (1000 x 1) vector of evenly spaced points on the x-axis. We then use this vector as the input to out distribution of choice (e.g. the Normal PDF) to obtain a vector of the probabilities for each corresponding x value; these will form our y-axis values in the plot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
x=linspace(-5,5,1000);&lt;br /&gt;
xnorm = normpdf(x);&lt;br /&gt;
figure&lt;br /&gt;
plot(x,xnorm,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,2)&lt;br /&gt;
title(&amp;#039;Probability density plot of standard Normal distribution&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
As before, we can add additional plots to this graph. In the next example we plot the t-distribution for increasing degrees of freedom &amp;lt;code&amp;gt;df=[1,5,10]&amp;lt;/code&amp;gt; to show how the t-distribution approximates to the Normal distribution as the degrees of freedom increases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hold all&lt;br /&gt;
df = [1,5,10];&lt;br /&gt;
for ii=1:length(df)&lt;br /&gt;
    xt = tpdf(x,df(ii));&lt;br /&gt;
    plot(x,xt)&lt;br /&gt;
end&lt;br /&gt;
title(&amp;#039;Comparing t-distributions with standard Normal&amp;#039;)&lt;br /&gt;
legend(&amp;#039;Normal&amp;#039;,&amp;#039;T-dist df=1&amp;#039;,&amp;#039;T-dist df=5&amp;#039;,&amp;#039;T-dist df=10&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot2.png]]&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;br /&gt;
&lt;br /&gt;
Kernel Density estimation is a way to estimate the probability density function of a random variable from a sample of data. Returning to the stock market values data used above we can fit a PDF to this data using the &amp;lt;code&amp;gt;ksdensity&amp;lt;/code&amp;gt; function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
[f,xi] = ksdensity(stocks(:));&lt;br /&gt;
plot(xi,f,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,1.5)&lt;br /&gt;
title(&amp;#039;Kernel density plot of stock market returns&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:KernelPlot1.png]]&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4077</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4077"/>
				<updated>2015-10-25T19:38:26Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Observed Distributions/Kernel Density Plots */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
Matlab has some very powerful graphics capabilities for plotting data in many different styles. Whilst the syntax for most of the basic plotting functions is simple, the more advanced features can be quite daunting to the uninitiated. In this section we introduce some of the common plot types that you will need in your econometric analysis and presentation.&lt;br /&gt;
&lt;br /&gt;
For a complete exposition of all Matlab&amp;#039;s graphics features refer to [http://uk.mathworks.com/help/pdf_doc/matlab/graphg.pdf Matlab&amp;#039;s Graphics Guide].&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;hold on&amp;lt;/source&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to a horizontal lines for the mean and another two indicating +/- 1 standard deviation from the mean for the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
avg=mean(stocks(:));&lt;br /&gt;
sd=std(stocks(:));&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [avg avg],&amp;#039;-k&amp;#039;)&lt;br /&gt;
plot(xlim, [avg+sd avg+sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [avg-sd avg-sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;xlim&amp;lt;/source&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;-k&amp;#039; argument specifies the plotted line to be a solid black line, whereas the &amp;#039;--r&amp;#039; arguments specifies the plotted line as a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
In this example we use the wage data from the Wooldridge dataset &amp;#039;wages1&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scatter by group, in this case on gender.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
Matlab has a number of statistical distributions, see [[StatFunct]] for an introduction. We can use the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function to graph these distributions. The first thing to do is generate a vector of suitable values for the x-axis; in this example we use the &amp;lt;code&amp;gt;linspace&amp;lt;/code&amp;gt; function to create a (1000 x 1) vector of evenly spaced points on the x-axis. We then use this vector as the input to out distribution of choice (e.g. the Normal PDF) to obtain a vector of the probabilities for each corresponding x value; these will form our y-axis values in the plot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
x=linspace(-5,5,1000);&lt;br /&gt;
xnorm = normpdf(x);&lt;br /&gt;
figure&lt;br /&gt;
plot(x,xnorm,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,2)&lt;br /&gt;
title(&amp;#039;Probability density plot of standard Normal distribution&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
As before, we can add additional plots to this graph. In the next example we plot the t-distribution for increasing degrees of freedom &amp;lt;code&amp;gt;df=[1,5,10]&amp;lt;/code&amp;gt; to show how the t-distribution approximates to the Normal distribution as the degrees of freedom increases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hold all&lt;br /&gt;
df = [1,5,10];&lt;br /&gt;
for ii=1:length(df)&lt;br /&gt;
    xt = tpdf(x,df(ii));&lt;br /&gt;
    plot(x,xt)&lt;br /&gt;
end&lt;br /&gt;
title(&amp;#039;Comparing t-distributions with standard Normal&amp;#039;)&lt;br /&gt;
legend(&amp;#039;Normal&amp;#039;,&amp;#039;T-dist df=1&amp;#039;,&amp;#039;T-dist df=5&amp;#039;,&amp;#039;T-dist df=10&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot2.png]]&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;br /&gt;
&lt;br /&gt;
Kernel Density estimation is a way to estimate the probability density function of a random variable from a sample of data. Returning to the stock market values data used above we can fit a PDF to this data using the &amp;lt;code&amp;gt;ksdensity&amp;lt;/code&amp;gt; function as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
[f,xi] = ksdensity(stocks(:));&lt;br /&gt;
plot(xi,f,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,1.5)&lt;br /&gt;
title(&amp;#039;Kernel density plot of stock market returns&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:KernelPlot1.png]]&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4076</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4076"/>
				<updated>2015-10-25T19:31:33Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Theoretical Distributions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
Matlab has some very powerful graphics capabilities for plotting data in many different styles. Whilst the syntax for most of the basic plotting functions is simple, the more advanced features can be quite daunting to the uninitiated. In this section we introduce some of the common plot types that you will need in your econometric analysis and presentation.&lt;br /&gt;
&lt;br /&gt;
For a complete exposition of all Matlab&amp;#039;s graphics features refer to [http://uk.mathworks.com/help/pdf_doc/matlab/graphg.pdf Matlab&amp;#039;s Graphics Guide].&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;hold on&amp;lt;/source&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to a horizontal lines for the mean and another two indicating +/- 1 standard deviation from the mean for the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
avg=mean(stocks(:));&lt;br /&gt;
sd=std(stocks(:));&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [avg avg],&amp;#039;-k&amp;#039;)&lt;br /&gt;
plot(xlim, [avg+sd avg+sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [avg-sd avg-sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;xlim&amp;lt;/source&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;-k&amp;#039; argument specifies the plotted line to be a solid black line, whereas the &amp;#039;--r&amp;#039; arguments specifies the plotted line as a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
In this example we use the wage data from the Wooldridge dataset &amp;#039;wages1&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scatter by group, in this case on gender.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
Matlab has a number of statistical distributions, see [[StatFunct]] for an introduction. We can use the &amp;lt;code&amp;gt;plot&amp;lt;/code&amp;gt; function to graph these distributions. The first thing to do is generate a vector of suitable values for the x-axis; in this example we use the &amp;lt;code&amp;gt;linspace&amp;lt;/code&amp;gt; function to create a (1000 x 1) vector of evenly spaced points on the x-axis. We then use this vector as the input to out distribution of choice (e.g. the Normal PDF) to obtain a vector of the probabilities for each corresponding x value; these will form our y-axis values in the plot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
x=linspace(-5,5,1000);&lt;br /&gt;
xnorm = normpdf(x);&lt;br /&gt;
figure&lt;br /&gt;
plot(x,xnorm,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,2)&lt;br /&gt;
title(&amp;#039;Probability density plot of standard Normal distribution&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
As before, we can add additional plots to this graph. In the next example we plot the t-distribution for increasing degrees of freedom &amp;lt;code&amp;gt;df=[1,5,10]&amp;lt;/code&amp;gt; to show how the t-distribution approximates to the Normal distribution as the degrees of freedom increases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hold all&lt;br /&gt;
df = [1,5,10];&lt;br /&gt;
for ii=1:length(df)&lt;br /&gt;
    xt = tpdf(x,df(ii));&lt;br /&gt;
    plot(x,xt)&lt;br /&gt;
end&lt;br /&gt;
title(&amp;#039;Comparing t-distributions with standard Normal&amp;#039;)&lt;br /&gt;
legend(&amp;#039;Normal&amp;#039;,&amp;#039;T-dist df=1&amp;#039;,&amp;#039;T-dist df=5&amp;#039;,&amp;#039;T-dist df=10&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot2.png]]&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
[f,xi] = ksdensity(stocks(:));&lt;br /&gt;
plot(xi,f,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,1.5)&lt;br /&gt;
title(&amp;#039;Kernel density plot of stock market returns&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:KernelPlot1.png]]&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4075</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4075"/>
				<updated>2015-10-23T21:40:54Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
Matlab has some very powerful graphics capabilities for plotting data in many different styles. Whilst the syntax for most of the basic plotting functions is simple, the more advanced features can be quite daunting to the uninitiated. In this section we introduce some of the common plot types that you will need in your econometric analysis and presentation.&lt;br /&gt;
&lt;br /&gt;
For a complete exposition of all Matlab&amp;#039;s graphics features refer to [http://uk.mathworks.com/help/pdf_doc/matlab/graphg.pdf Matlab&amp;#039;s Graphics Guide].&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;hold on&amp;lt;/source&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to a horizontal lines for the mean and another two indicating +/- 1 standard deviation from the mean for the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
avg=mean(stocks(:));&lt;br /&gt;
sd=std(stocks(:));&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [avg avg],&amp;#039;-k&amp;#039;)&lt;br /&gt;
plot(xlim, [avg+sd avg+sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [avg-sd avg-sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;xlim&amp;lt;/source&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;-k&amp;#039; argument specifies the plotted line to be a solid black line, whereas the &amp;#039;--r&amp;#039; arguments specifies the plotted line as a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
In this example we use the wage data from the Wooldridge dataset &amp;#039;wages1&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scatter by group, in this case on gender.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
x=linspace(-5,5,1000);&lt;br /&gt;
xnorm = normpdf(x);&lt;br /&gt;
figure&lt;br /&gt;
plot(x,xnorm,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,2)&lt;br /&gt;
title(&amp;#039;Probability density plot of standard Normal distribution&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hold all&lt;br /&gt;
df = [1,5,10];&lt;br /&gt;
for ii=1:length(df)&lt;br /&gt;
    xt = tpdf(x,df(ii));&lt;br /&gt;
    plot(x,xt)&lt;br /&gt;
end&lt;br /&gt;
title(&amp;#039;Comparing t-distributions with standard Normal&amp;#039;)&lt;br /&gt;
legend(&amp;#039;Normal&amp;#039;,&amp;#039;T-dist df=1&amp;#039;,&amp;#039;T-dist df=5&amp;#039;,&amp;#039;T-dist df=10&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot2.png]]&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
[f,xi] = ksdensity(stocks(:));&lt;br /&gt;
plot(xi,f,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,1.5)&lt;br /&gt;
title(&amp;#039;Kernel density plot of stock market returns&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:KernelPlot1.png]]&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4074</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4074"/>
				<updated>2015-10-23T21:29:24Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Line Plots */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;hold on&amp;lt;/source&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to a horizontal lines for the mean and another two indicating +/- 1 standard deviation from the mean for the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
avg=mean(stocks(:));&lt;br /&gt;
sd=std(stocks(:));&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [avg avg],&amp;#039;-k&amp;#039;)&lt;br /&gt;
plot(xlim, [avg+sd avg+sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [avg-sd avg-sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;xlim&amp;lt;/source&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;-k&amp;#039; argument specifies the plotted line to be a solid black line, whereas the &amp;#039;--r&amp;#039; arguments specifies the plotted line as a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
In this example we use the wage data from the Wooldridge dataset &amp;#039;wages1&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scatter by group, in this case on gender.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
x=linspace(-5,5,1000);&lt;br /&gt;
xnorm = normpdf(x);&lt;br /&gt;
figure&lt;br /&gt;
plot(x,xnorm,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,2)&lt;br /&gt;
title(&amp;#039;Probability density plot of standard Normal distribution&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hold all&lt;br /&gt;
df = [1,5,10];&lt;br /&gt;
for ii=1:length(df)&lt;br /&gt;
    xt = tpdf(x,df(ii));&lt;br /&gt;
    plot(x,xt)&lt;br /&gt;
end&lt;br /&gt;
title(&amp;#039;Comparing t-distributions with standard Normal&amp;#039;)&lt;br /&gt;
legend(&amp;#039;Normal&amp;#039;,&amp;#039;T-dist df=1&amp;#039;,&amp;#039;T-dist df=5&amp;#039;,&amp;#039;T-dist df=10&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot2.png]]&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
[f,xi] = ksdensity(stocks(:));&lt;br /&gt;
plot(xi,f,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,1.5)&lt;br /&gt;
title(&amp;#039;Kernel density plot of stock market returns&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:KernelPlot1.png]]&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=File:Lineplot2.png&amp;diff=4073</id>
		<title>File:Lineplot2.png</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=File:Lineplot2.png&amp;diff=4073"/>
				<updated>2015-10-23T21:27:27Z</updated>
		
		<summary type="html">&lt;p&gt;JL: JL uploaded a new version of File:Lineplot2.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=File:Lineplot2.png&amp;diff=4072</id>
		<title>File:Lineplot2.png</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=File:Lineplot2.png&amp;diff=4072"/>
				<updated>2015-10-23T21:26:44Z</updated>
		
		<summary type="html">&lt;p&gt;JL: JL uploaded a new version of File:Lineplot2.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=File:Lineplot2.png&amp;diff=4071</id>
		<title>File:Lineplot2.png</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=File:Lineplot2.png&amp;diff=4071"/>
				<updated>2015-10-23T21:26:01Z</updated>
		
		<summary type="html">&lt;p&gt;JL: JL uploaded a new version of File:Lineplot2.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4070</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4070"/>
				<updated>2015-10-23T21:25:44Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Line Plots */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;hold on&amp;lt;/source&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to a horizontal lines for the mean and another two indicating +/- 1 standard deviation from the mean for the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
avg=mean(stocks(:));&lt;br /&gt;
sd=std(stocks(:));&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [avg avg],&amp;#039;-k&amp;#039;)&lt;br /&gt;
plot(xlim, [avg+sd avg+sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [avg-sd avg-sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;xlim&amp;lt;/source&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;--r&amp;#039; arguments specifies the plotted line to a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
In this example we use the wage data from the Wooldridge dataset &amp;#039;wages1&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scatter by group, in this case on gender.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
x=linspace(-5,5,1000);&lt;br /&gt;
xnorm = normpdf(x);&lt;br /&gt;
figure&lt;br /&gt;
plot(x,xnorm,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,2)&lt;br /&gt;
title(&amp;#039;Probability density plot of standard Normal distribution&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hold all&lt;br /&gt;
df = [1,5,10];&lt;br /&gt;
for ii=1:length(df)&lt;br /&gt;
    xt = tpdf(x,df(ii));&lt;br /&gt;
    plot(x,xt)&lt;br /&gt;
end&lt;br /&gt;
title(&amp;#039;Comparing t-distributions with standard Normal&amp;#039;)&lt;br /&gt;
legend(&amp;#039;Normal&amp;#039;,&amp;#039;T-dist df=1&amp;#039;,&amp;#039;T-dist df=5&amp;#039;,&amp;#039;T-dist df=10&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot2.png]]&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
[f,xi] = ksdensity(stocks(:));&lt;br /&gt;
plot(xi,f,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,1.5)&lt;br /&gt;
title(&amp;#039;Kernel density plot of stock market returns&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:KernelPlot1.png]]&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4069</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4069"/>
				<updated>2015-10-23T21:13:09Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Line Plots */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;hold on&amp;lt;/source&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to horizontal lines indicating +/- 1 standard deviation of the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
sd=std(stocks(:);&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [sd sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [-sd -sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;xlim&amp;lt;/source&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;--r&amp;#039; arguments specifies the plotted line to a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
In this example we use the wage data from the Wooldridge dataset &amp;#039;wages1&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scatter by group, in this case on gender.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
x=linspace(-5,5,1000);&lt;br /&gt;
xnorm = normpdf(x);&lt;br /&gt;
figure&lt;br /&gt;
plot(x,xnorm,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,2)&lt;br /&gt;
title(&amp;#039;Probability density plot of standard Normal distribution&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hold all&lt;br /&gt;
df = [1,5,10];&lt;br /&gt;
for ii=1:length(df)&lt;br /&gt;
    xt = tpdf(x,df(ii));&lt;br /&gt;
    plot(x,xt)&lt;br /&gt;
end&lt;br /&gt;
title(&amp;#039;Comparing t-distributions with standard Normal&amp;#039;)&lt;br /&gt;
legend(&amp;#039;Normal&amp;#039;,&amp;#039;T-dist df=1&amp;#039;,&amp;#039;T-dist df=5&amp;#039;,&amp;#039;T-dist df=10&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot2.png]]&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
[f,xi] = ksdensity(stocks(:));&lt;br /&gt;
plot(xi,f,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,1.5)&lt;br /&gt;
title(&amp;#039;Kernel density plot of stock market returns&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:KernelPlot1.png]]&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4068</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4068"/>
				<updated>2015-10-23T21:12:38Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Line Plots */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png|600px]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;hold on&amp;lt;/source&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to horizontal lines indicating +/- 1 standard deviation of the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
sd=std(stocks(:);&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [sd sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [-sd -sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;xlim&amp;lt;/source&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;--r&amp;#039; arguments specifies the plotted line to a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
In this example we use the wage data from the Wooldridge dataset &amp;#039;wages1&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scatter by group, in this case on gender.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
x=linspace(-5,5,1000);&lt;br /&gt;
xnorm = normpdf(x);&lt;br /&gt;
figure&lt;br /&gt;
plot(x,xnorm,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,2)&lt;br /&gt;
title(&amp;#039;Probability density plot of standard Normal distribution&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hold all&lt;br /&gt;
df = [1,5,10];&lt;br /&gt;
for ii=1:length(df)&lt;br /&gt;
    xt = tpdf(x,df(ii));&lt;br /&gt;
    plot(x,xt)&lt;br /&gt;
end&lt;br /&gt;
title(&amp;#039;Comparing t-distributions with standard Normal&amp;#039;)&lt;br /&gt;
legend(&amp;#039;Normal&amp;#039;,&amp;#039;T-dist df=1&amp;#039;,&amp;#039;T-dist df=5&amp;#039;,&amp;#039;T-dist df=10&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot2.png]]&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
[f,xi] = ksdensity(stocks(:));&lt;br /&gt;
plot(xi,f,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,1.5)&lt;br /&gt;
title(&amp;#039;Kernel density plot of stock market returns&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:KernelPlot1.png]]&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4067</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4067"/>
				<updated>2015-10-23T21:11:53Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Line Plots */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png|200px]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;hold on&amp;lt;/source&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to horizontal lines indicating +/- 1 standard deviation of the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
sd=std(stocks(:);&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [sd sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [-sd -sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;xlim&amp;lt;/source&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;--r&amp;#039; arguments specifies the plotted line to a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
In this example we use the wage data from the Wooldridge dataset &amp;#039;wages1&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scatter by group, in this case on gender.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
x=linspace(-5,5,1000);&lt;br /&gt;
xnorm = normpdf(x);&lt;br /&gt;
figure&lt;br /&gt;
plot(x,xnorm,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,2)&lt;br /&gt;
title(&amp;#039;Probability density plot of standard Normal distribution&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hold all&lt;br /&gt;
df = [1,5,10];&lt;br /&gt;
for ii=1:length(df)&lt;br /&gt;
    xt = tpdf(x,df(ii));&lt;br /&gt;
    plot(x,xt)&lt;br /&gt;
end&lt;br /&gt;
title(&amp;#039;Comparing t-distributions with standard Normal&amp;#039;)&lt;br /&gt;
legend(&amp;#039;Normal&amp;#039;,&amp;#039;T-dist df=1&amp;#039;,&amp;#039;T-dist df=5&amp;#039;,&amp;#039;T-dist df=10&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot2.png]]&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
[f,xi] = ksdensity(stocks(:));&lt;br /&gt;
plot(xi,f,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,1.5)&lt;br /&gt;
title(&amp;#039;Kernel density plot of stock market returns&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:KernelPlot1.png]]&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=File:KernelPlot1.png&amp;diff=4066</id>
		<title>File:KernelPlot1.png</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=File:KernelPlot1.png&amp;diff=4066"/>
				<updated>2015-10-23T21:10:45Z</updated>
		
		<summary type="html">&lt;p&gt;JL: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4065</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4065"/>
				<updated>2015-10-23T21:10:20Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Observed Distributions/Kernel Density Plots */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;hold on&amp;lt;/source&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to horizontal lines indicating +/- 1 standard deviation of the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
sd=std(stocks(:);&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [sd sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [-sd -sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;xlim&amp;lt;/source&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;--r&amp;#039; arguments specifies the plotted line to a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
In this example we use the wage data from the Wooldridge dataset &amp;#039;wages1&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scatter by group, in this case on gender.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
x=linspace(-5,5,1000);&lt;br /&gt;
xnorm = normpdf(x);&lt;br /&gt;
figure&lt;br /&gt;
plot(x,xnorm,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,2)&lt;br /&gt;
title(&amp;#039;Probability density plot of standard Normal distribution&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hold all&lt;br /&gt;
df = [1,5,10];&lt;br /&gt;
for ii=1:length(df)&lt;br /&gt;
    xt = tpdf(x,df(ii));&lt;br /&gt;
    plot(x,xt)&lt;br /&gt;
end&lt;br /&gt;
title(&amp;#039;Comparing t-distributions with standard Normal&amp;#039;)&lt;br /&gt;
legend(&amp;#039;Normal&amp;#039;,&amp;#039;T-dist df=1&amp;#039;,&amp;#039;T-dist df=5&amp;#039;,&amp;#039;T-dist df=10&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot2.png]]&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
[f,xi] = ksdensity(stocks(:));&lt;br /&gt;
plot(xi,f,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,1.5)&lt;br /&gt;
title(&amp;#039;Kernel density plot of stock market returns&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:KernelPlot1.png]]&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4064</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4064"/>
				<updated>2015-10-23T20:29:34Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Scatter Diagrams */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;hold on&amp;lt;/source&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to horizontal lines indicating +/- 1 standard deviation of the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
sd=std(stocks(:);&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [sd sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [-sd -sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;xlim&amp;lt;/source&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;--r&amp;#039; arguments specifies the plotted line to a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
In this example we use the wage data from the Wooldridge dataset &amp;#039;wages1&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scatter by group, in this case on gender.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
x=linspace(-5,5,1000);&lt;br /&gt;
xnorm = normpdf(x);&lt;br /&gt;
figure&lt;br /&gt;
plot(x,xnorm,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,2)&lt;br /&gt;
title(&amp;#039;Probability density plot of standard Normal distribution&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hold all&lt;br /&gt;
df = [1,5,10];&lt;br /&gt;
for ii=1:length(df)&lt;br /&gt;
    xt = tpdf(x,df(ii));&lt;br /&gt;
    plot(x,xt)&lt;br /&gt;
end&lt;br /&gt;
title(&amp;#039;Comparing t-distributions with standard Normal&amp;#039;)&lt;br /&gt;
legend(&amp;#039;Normal&amp;#039;,&amp;#039;T-dist df=1&amp;#039;,&amp;#039;T-dist df=5&amp;#039;,&amp;#039;T-dist df=10&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot2.png]]&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=File:TheoreticalPlot2.png&amp;diff=4063</id>
		<title>File:TheoreticalPlot2.png</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=File:TheoreticalPlot2.png&amp;diff=4063"/>
				<updated>2015-10-23T20:27:46Z</updated>
		
		<summary type="html">&lt;p&gt;JL: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=File:TheoreticalPlot1.png&amp;diff=4062</id>
		<title>File:TheoreticalPlot1.png</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=File:TheoreticalPlot1.png&amp;diff=4062"/>
				<updated>2015-10-23T20:27:32Z</updated>
		
		<summary type="html">&lt;p&gt;JL: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4061</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4061"/>
				<updated>2015-10-23T20:27:13Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Theoretical Distributions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;hold on&amp;lt;/source&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to horizontal lines indicating +/- 1 standard deviation of the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
sd=std(stocks(:);&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [sd sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [-sd -sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;xlim&amp;lt;/source&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;--r&amp;#039; arguments specifies the plotted line to a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
x=linspace(-5,5,1000);&lt;br /&gt;
xnorm = normpdf(x);&lt;br /&gt;
figure&lt;br /&gt;
plot(x,xnorm,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,2)&lt;br /&gt;
title(&amp;#039;Probability density plot of standard Normal distribution&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hold all&lt;br /&gt;
df = [1,5,10];&lt;br /&gt;
for ii=1:length(df)&lt;br /&gt;
    xt = tpdf(x,df(ii));&lt;br /&gt;
    plot(x,xt)&lt;br /&gt;
end&lt;br /&gt;
title(&amp;#039;Comparing t-distributions with standard Normal&amp;#039;)&lt;br /&gt;
legend(&amp;#039;Normal&amp;#039;,&amp;#039;T-dist df=1&amp;#039;,&amp;#039;T-dist df=5&amp;#039;,&amp;#039;T-dist df=10&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot2.png]]&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4060</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4060"/>
				<updated>2015-10-23T20:23:13Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Theoretical Distributions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;hold on&amp;lt;/source&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to horizontal lines indicating +/- 1 standard deviation of the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
sd=std(stocks(:);&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [sd sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [-sd -sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;xlim&amp;lt;/source&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;--r&amp;#039; arguments specifies the plotted line to a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
x=linspace(-5,5,1000);&lt;br /&gt;
xnorm = normpdf(x);&lt;br /&gt;
plot(x,xnorm,&amp;#039;-k&amp;#039;,&amp;#039;LineWidth&amp;#039;,2)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hold all&lt;br /&gt;
df = [1,5,10];&lt;br /&gt;
for ii=1:length(df)&lt;br /&gt;
    xt = tpdf(x,df(ii));&lt;br /&gt;
    plot(x,xt)&lt;br /&gt;
end&lt;br /&gt;
legend(&amp;#039;Normal&amp;#039;,&amp;#039;T-dist df=1&amp;#039;,&amp;#039;T-dist df=5&amp;#039;,&amp;#039;T-dist df=10&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:TheoreticalPlot2.png]]&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=File:Histplot2.png&amp;diff=4059</id>
		<title>File:Histplot2.png</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=File:Histplot2.png&amp;diff=4059"/>
				<updated>2015-10-23T20:06:49Z</updated>
		
		<summary type="html">&lt;p&gt;JL: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=File:Histplot1.png&amp;diff=4058</id>
		<title>File:Histplot1.png</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=File:Histplot1.png&amp;diff=4058"/>
				<updated>2015-10-23T20:06:34Z</updated>
		
		<summary type="html">&lt;p&gt;JL: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4057</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4057"/>
				<updated>2015-10-23T20:05:47Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Histograms */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;hold on&amp;lt;/source&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to horizontal lines indicating +/- 1 standard deviation of the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
sd=std(stocks(:);&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [sd sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [-sd -sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;xlim&amp;lt;/source&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;--r&amp;#039; arguments specifies the plotted line to a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4056</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4056"/>
				<updated>2015-10-23T20:05:24Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Histograms */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;hold on&amp;lt;/source&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to horizontal lines indicating +/- 1 standard deviation of the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
sd=std(stocks(:);&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [sd sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [-sd -sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;xlim&amp;lt;/source&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;--r&amp;#039; arguments specifies the plotted line to a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
hist(stocks(:))&lt;br /&gt;
&amp;lt;/source)&lt;br /&gt;
[[File:histplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
hist(stocks(:),40)&lt;br /&gt;
set(get(gca,&amp;#039;child&amp;#039;),&amp;#039;FaceColor&amp;#039;,&amp;#039;cyan&amp;#039;,&amp;#039;EdgeColor&amp;#039;,&amp;#039;blue&amp;#039;);&lt;br /&gt;
title(&amp;#039;Histogram of stock prices&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:histplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4055</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4055"/>
				<updated>2015-10-23T19:52:01Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Scatter Diagrams */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;hold on&amp;lt;/source&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to horizontal lines indicating +/- 1 standard deviation of the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
sd=std(stocks(:);&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [sd sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [-sd -sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;xlim&amp;lt;/source&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;--r&amp;#039; arguments specifies the plotted line to a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Histograms = &lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=File:Scatterplot2.png&amp;diff=4054</id>
		<title>File:Scatterplot2.png</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=File:Scatterplot2.png&amp;diff=4054"/>
				<updated>2015-10-23T19:51:05Z</updated>
		
		<summary type="html">&lt;p&gt;JL: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=File:Scatterplot1.png&amp;diff=4053</id>
		<title>File:Scatterplot1.png</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=File:Scatterplot1.png&amp;diff=4053"/>
				<updated>2015-10-23T19:50:49Z</updated>
		
		<summary type="html">&lt;p&gt;JL: JL uploaded a new version of File:Scatterplot1.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=File:Scatterplot1.png&amp;diff=4052</id>
		<title>File:Scatterplot1.png</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=File:Scatterplot1.png&amp;diff=4052"/>
				<updated>2015-10-23T19:49:40Z</updated>
		
		<summary type="html">&lt;p&gt;JL: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4051</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4051"/>
				<updated>2015-10-23T19:49:08Z</updated>
		
		<summary type="html">&lt;p&gt;JL: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
To modify an existing plot use the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;hold on&amp;lt;/source&amp;gt; command. Subsequent plots will then be added to the current figure. For example to add to horizontal lines indicating +/- 1 standard deviation of the stocks data:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
sd=std(stocks(:);&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [sd sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [-sd -sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
Here, in each case the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;plot&amp;lt;/source&amp;gt; function is plotting a straight line between two points. The first argument, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;xlim&amp;lt;/source&amp;gt; queries the figure to get the coordinates of the start and end of the x-axis (a two element vector), provides the x coordinates. The second argument is a vector containing the corresponding y coordinates of the two points.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;--r&amp;#039; arguments specifies the plotted line to a red dashed line. Matlab supports a number of line (and marker) types of varying colours; for full details refer to Matlab&amp;#039;s documentation on [http://uk.mathworks.com/help/matlab/ref/linespec.html LineSpec].&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
scatter(educ,wage)&lt;br /&gt;
&amp;lt;/source&lt;br /&gt;
[[File:scatterplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
gscatter(educ,wage,female,&amp;#039;rk&amp;#039;,&amp;#039;do&amp;#039;)&lt;br /&gt;
xlabel(&amp;#039;years of education&amp;#039;)&lt;br /&gt;
ylabel(&amp;#039;average hourly earnings&amp;#039;)&lt;br /&gt;
legend(&amp;#039;female&amp;#039;,&amp;#039;male&amp;#039;,&amp;#039;Location&amp;#039;,&amp;#039;northwest&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:scatterplot2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Histograms = &lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=File:Lineplot1.png&amp;diff=4050</id>
		<title>File:Lineplot1.png</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=File:Lineplot1.png&amp;diff=4050"/>
				<updated>2015-10-23T19:22:01Z</updated>
		
		<summary type="html">&lt;p&gt;JL: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=File:Lineplot2.png&amp;diff=4049</id>
		<title>File:Lineplot2.png</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=File:Lineplot2.png&amp;diff=4049"/>
				<updated>2015-10-23T19:20:50Z</updated>
		
		<summary type="html">&lt;p&gt;JL: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4048</id>
		<title>Graphing</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Graphing&amp;diff=4048"/>
				<updated>2015-10-23T19:19:41Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Line Plots */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
= Line Plots =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example we use one of Matlab&amp;#039;s sample dataset to plot a simple line plot showing the time series movement of the stock market data.&lt;br /&gt;
First Load the data.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
load stockreturns&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the &amp;#039;plot&amp;#039; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
figure&lt;br /&gt;
plot(stocks(:))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
sd=std(stocks(:);&lt;br /&gt;
hold on&lt;br /&gt;
plot(xlim, [sd sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
plot(xlim, [-sd -sd],&amp;#039;--r&amp;#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:lineplot2.png]]&lt;br /&gt;
&lt;br /&gt;
= Scatter Diagrams =&lt;br /&gt;
&lt;br /&gt;
= Histograms = &lt;br /&gt;
&lt;br /&gt;
= Distribution Plots =&lt;br /&gt;
&lt;br /&gt;
== Theoretical Distributions ==&lt;br /&gt;
&lt;br /&gt;
== Observed Distributions/Kernel Density Plots ==&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=R&amp;diff=3891</id>
		<title>R</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=R&amp;diff=3891"/>
				<updated>2015-07-20T09:10:44Z</updated>
		
		<summary type="html">&lt;p&gt;JL: /* Data Sets */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;R is an open source software that has been been adopted by the statistical community as its standard software package. It is a command driven software, meaning that you will have to give the software written commands to indicate what you do. On first sight this is not as convenient as a menu driven software, but it has the huge advantage that you can collect a large set of commands in a file (script file) and then have R execute all these commands in one go. This then serves as a great documentation of the work you have done and most importantly it makes it easy to change a small aspect of your work and rerun the entire project on the press of a button rather than having to laboriously retrace all your steps through menus.&lt;br /&gt;
&lt;br /&gt;
The fixed cost of learning this software is higher than learning a menu driven statistical software package. But if you engage with this process the rewards will be great.&lt;br /&gt;
&lt;br /&gt;
Last not least, R has a killer advantage. It is free!!!&lt;br /&gt;
&lt;br /&gt;
== Installing the Software ==&lt;br /&gt;
&lt;br /&gt;
[https://youtu.be/EHjakj38Nnw?hd=1 Installation Demonstration]&lt;br /&gt;
&lt;br /&gt;
To work with R you will have to install the basic software package R, but we also advise you to install RStudio, which is an add-on to R (formally called an Integrated Development Environment - IDE) which makes working with R easier.&lt;br /&gt;
&lt;br /&gt;
As this is open-source software that you get for free it is perhaps understandable that the webpages from which you get the R software aren&amp;#039;t as slick as you expect. And the language tends to be somewhat more techy, but don&amp;#039;t worry, you&amp;#039;ll be fine.&lt;br /&gt;
&lt;br /&gt;
So here are the steps you should take. &lt;br /&gt;
&lt;br /&gt;
# Download and install the R software, which is available from the [http://cran.rstudio.com/ CRAN] website. Follow the &amp;quot;Download and Install R&amp;quot; link (and do not be tempted to download the source code!) for your operating system. If you have a window OS only choose the &amp;quot;base&amp;quot; package on the following screen. Then follow the usual installation instructions. You could now already work with R, but we recommend that you first undertake the next step.&lt;br /&gt;
# Once we have installed R, we can download and install RStudio. You can download it from the [http://www.rstudio.com/products/rstudio/download/ RStudio] download page.&lt;br /&gt;
&lt;br /&gt;
The basic R software has some basic functionality, but the power of R comes from the ability to use code written to perform statistical and econometric techniques that has been written by other people. These additional pieces of software are called packages and the next step will be to learn how ot use these.&lt;br /&gt;
&lt;br /&gt;
== Data Sets ==&lt;br /&gt;
&lt;br /&gt;
We use a number of datasets on this page. For convenience they are listed here:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| &lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Women&amp;#039;s wages &lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Crime Statistics&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Baseball Wages&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
| Observations for 753 females on wages, familiar and work circumstances hours worked and wages&lt;br /&gt;
| Crime Statistics for 90 counties in North Carolina (US) for Years 1981 to 1987 (Panel Data); includes a number of variables to characterise the counties&lt;br /&gt;
| Salary and other information (such as race, position and performance information) for 353 Baseball Players in 1993&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Files&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
| [[media:mroz.xls|mroz.xls]] &amp;lt;br&amp;gt; [[media:mroz.csv|mroz.csv]] &amp;lt;br&amp;gt; [[media:mroz.RData|mroz.RData]] &lt;br /&gt;
| [[media:crim4.xls|crime4.xls]]  &amp;lt;br&amp;gt; [[media:crim4.csv|crime4.csv]]&lt;br /&gt;
| [[media:mlb1.xls|mlb1.xls]] &amp;lt;br&amp;gt; [[media:mlb1.csv|mlb1.csv]]&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Source&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
| [http://www.cengagebrain.com/cgi-wadsworth/course_products_wp.pl?fid=M20b&amp;amp;product_isbn_issn=9781111531041&amp;amp;token=8D04240DC39B22D05B49B265F2C8E62C6876DDE99FE979BC4A500075EC976963ED1045639B2C75C4B5B2337F07088998 Wooldridge Book Companion Page]&lt;br /&gt;
| [http://www.cengagebrain.com/cgi-wadsworth/course_products_wp.pl?fid=M20b&amp;amp;product_isbn_issn=9781111531041&amp;amp;token=8D04240DC39B22D05B49B265F2C8E62C6876DDE99FE979BC4A500075EC976963ED1045639B2C75C4B5B2337F07088998 Wooldridge Book Companion Page]&lt;br /&gt;
| [http://www.cengagebrain.com/cgi-wadsworth/course_products_wp.pl?fid=M20b&amp;amp;product_isbn_issn=9781111531041&amp;amp;token=8D04240DC39B22D05B49B265F2C8E62C6876DDE99FE979BC4A500075EC976963ED1045639B2C75C4B5B2337F07088998 Wooldridge Book Companion Page]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Following the links in the above table you will also be able to download R data files for these datasets.&lt;br /&gt;
&lt;br /&gt;
== Basic Tasks ==&lt;br /&gt;
&lt;br /&gt;
To illustrate how to perform basic tasks in R we will use data that you can download from here: [[media:mroz.xls|mroz.xls]]. This is an Excel file that contains a dataset which we will use for our first steps in R. It is a well used cross-sectional dataset with 753 observations of female members of the labour force in the US (in 1975). It contains variables such as the number of children, the wage, the hours worked etc. A bit more detail on the data and the variables can be found in this [[media:mroz_description.pdf|file]]. See also [https://ideas.repec.org/p/boc/bocins/mroz.html].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| First Steps&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Loading Data and&amp;lt;br&amp;gt;Date Formats &lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Basic Data&amp;lt;br&amp;gt;Analysis&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&amp;lt;br&amp;gt;Regression&lt;br /&gt;
|-&lt;br /&gt;
| [[R_FirstSteps|Discussion]] &lt;br /&gt;
| [[R_Data|Discussion]]&lt;br /&gt;
| [[R_Analysis|Discussion]] &lt;br /&gt;
| [[R_Regression|Discussion]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Using&amp;lt;br&amp;gt;Packages&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Saving Data and&amp;lt;br&amp;gt;Screen Output&lt;br /&gt;
|-&lt;br /&gt;
| [[R_Packages|Discussion]]  &lt;br /&gt;
| [[R_SavingData|Discussion]] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bread and Butter Techniques ==&lt;br /&gt;
&lt;br /&gt;
These are standard econometric problems tasks that any applied econometrician, and indeed aspiring economics students, should be familiar with.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Dummy&amp;lt;br&amp;gt;variables&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Standard&amp;lt;br&amp;gt;inference&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Regression&amp;lt;br&amp;gt;diagnostics&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Robust&amp;lt;br&amp;gt;standard errors&lt;br /&gt;
|-&lt;br /&gt;
| [[Dummy Variables in R|Discussion]] &lt;br /&gt;
| [[Regression Inference in R|Discussion]] &lt;br /&gt;
| [[R_reg_diag|Discussion]] &lt;br /&gt;
| [[R_robust_se|Discussion]]  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Intermediate Techniques ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Panel&amp;lt;br&amp;gt;Data&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Instrumental Variables&amp;lt;br&amp;gt;Estimation&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Univariate Time&amp;lt;br&amp;gt;Series Modelling&lt;br /&gt;
|-&lt;br /&gt;
| [[Panel in R|Discussion]] &lt;br /&gt;
| [[IV in R|Discussion]] &lt;br /&gt;
| [[R_TimeSeries|Discussion]]  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Econometric Demonstrations ==&lt;br /&gt;
&lt;br /&gt;
In this section you can find code that can be useful to demonstrate a few econometric issues.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Demonstrating OLS&amp;lt;br&amp;gt;estimator unbiasedness&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Demonstrating OLS estimator&amp;lt;br&amp;gt;asymptotic behaviour&lt;br /&gt;
|-&lt;br /&gt;
| [[R_Unbiasedness|Discussion]]  &lt;br /&gt;
| [[R_Asymptotics|Discussion]] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Authors, Maintenance and Contributions ==&lt;br /&gt;
&lt;br /&gt;
This wiki was created by [mailto:ralf.becker@manchester.ac.uk Ralf Becker] and [mailto:james.lincoln@manchester.ac.uk James Lincoln] with the financial support of a University of Manchester CHERIL grant. If you have any suggestions please contact us by email. Contributions to this wiki are encouraged. Please contact us for details.&lt;br /&gt;
&lt;br /&gt;
== More references ==&lt;br /&gt;
&lt;br /&gt;
There is a plethora of resources if you want to learn R (which is one reason why this resource does not go into too much detail). Here are a few places to start.&lt;br /&gt;
&lt;br /&gt;
* [http://www.computerworld.com/article/2497143/business-intelligence-beginner-s-guide-to-r-introduction.html?null A Beginner&amp;#039;s Guide to R]&lt;br /&gt;
* Some R resources provided by [http://www.ats.ucla.edu/stat/r/ UCLA]&lt;br /&gt;
* [http://www.statmethods.net Quick-R] web-site and [http://www.manning.com/kabacoff2/RiA2E_meap_ch1.pdf first chapter of R in Action]&lt;br /&gt;
* Just TryR it! [http://tryr.codeschool.com/levels/1/challenges/1]&lt;/div&gt;</summary>
		<author><name>JL</name></author>	</entry>

	</feed>