Test Post

This is for testing various techniques:

Upload of an equation from a pdf converted to a jpg


Seems to work reasonably well. Now a slightly smaller png file:


Not bad.

Try WordPress latex:

Now redo the equation above:

SSE = \sum\limits_{k = 1}^r {\sum\limits_{t = 1}^N {\left( {Y_k \left( t \right) - \alpha _k - \beta _k X\left( t \right)} \right)^2 } }

Yes!! It works.

BSI = .465 \cdot (1.000624)^{\left( {.99 + .914T} \right)^3 }

{\rm F(x) = }\int\limits_{{\rm - }\infty }^{\rm x} {{\rm g(t)h(x - t)dt}}

Post an R script as a block quote:


slopes = function(tsdat) {
star = min(time(tsdat))
slopes = rep(NA,12)
for (i in 1:12){
dat.win = window(tsdat,start=c(star,i),deltat=1)
yr = time(dat.win)
slopes[i] = ifelse(sum(!is.na(dat.win)) < 2, NA, coef(lm(dat.win~yr))[2])


all.slope = function(alldat) {
nc = ncol(alldat)
slop = matrix(NA, nrow = nc, ncol = 12)
colnames(slop) = month.abb
for (j in 1:nc) {
slop[j,]= slope(alldat[,j])}

test3 = all.slope(Data$aws[,6])

Quotes copy out wrong. This needs fixing.

New test:

Attach text document as .doc file:


SS = {1 \over 2}\sum\limits_{t = 1}^N {\sum\limits_{i,j = 1}^r {\mathop \delta \nolimits_i (t)\mathop \delta \nolimits_j (t)\left( {(x_i (t) - \mu _i ) - (x_j (t) - \mu _j )} \right)^2 } }

SS = \sum\limits_{t = 1}^N {\sum\limits_{k = 1}^r {\omega _k (t)\delta _k (t)\left( {x_k (t) - \tau (t) - \mu _k )} \right)^2 } }

SS = \sum\limits_{t = 1}^N {\sum\limits_{k = 1}^r {\omega _k (t)\delta _k (t)\left( {x_k (t) - \tau (t) - \mu _k (m(t))} \right)^2 } }

x_k (t) = \tau (t) + \mu _k  + \epsilon _k (t), t = 1,...,N,  k = 1,...,r


Filed under Uncategorized

2 responses to “Test Post

  1. Nick Stokes

    I have written a R script to verify Giorgio’s calculation. It does – I get a symmetric distribution, mean 0.0175 deg C/decade. and standard deviation 0.189 C/dec. The histogram is here. I tried to post a comment on his blog, but it hasn’t shown yet.

    To make it easier in R I edited (with emacs) to turn -9999 into NA and to separate the station numbers from the years.

    Here’s the script:
    #### A program written by Nick Stokes, 13 Dec 2009, to calculate the changes to regression
    # slopes caused by adjustments to the GHCN temperatures v2.mean_adj-v2.mean

    # A function to calculate regression slope. I hope it is faster than lm()
    s=(v %*% m)/(m %*% m)

    # read data from v2.mean and v2.mean_adj, downloaded from http://www1.ncdc.noaa.gov/pub/data/ghcn/v2/
    # I edited (emacs) to put a blank between the station number and year, and to change -9999 to NA (add .txt)

    # Read in data from the files in matrix form
    if(T){ #change to F after you have read in th efiles once
    vmean <- matrix(scan("v2.mean.txt", 0, skip=0,na.strings = "NA"), ncol=14, byrow=TRUE)
    vmean_adj <- matrix(scan("v2.mean_adj.txt", 0, skip=0,na.strings = "NA"), ncol=14, byrow=TRUE)
    # Now, to save time, move to annual averages
    vmean_ann[,3]=rowMeans(vmean[,3:14], na.rm = T)
    vmean_ann_adj[,3]=rowMeans(vmean_adj[,3:14], na.rm = T)

    # Initialise
    vv=rep(0.,200) # regression y vector
    jj=rep(0,200) # regression y vector
    grad=rep(0.,9999) # gradients (the output result)


    # counters. j is row of adjusted file. m is station counter
    # k,kk are local row (year) counter (for station m). k skips NA's, kk doesn't

    # loop over all rows in v2.mean
    for(i in 1:(len-1)){
    # to find matching rows, first check diff between stat nos and years
    # If the adjusted counter has got ahead of the unadj, wait
    if(j<jmax)j=j+1; u=vmean_ann_adj[j,]-vmean_ann[i,]
    # If we have a match, add to regression vec vv[]
    if(u[1]==0 & u[2]==0 ){

    if(!is.na(u[3])){ # don't add to regression if NA
    k=k+1 # local adjusted counter
    jj[k]=kk # x for regression
    vv[k]=u[3] # discrepancies for regression
    m=m+1 # m is station counter
    grad[m]=slope(vv[1:k],jj[1:k]) # compute regression slope
    k=0 # zero local counters
    # Now prepare histogram. Comment out jpeg and dev.off() to get screen graphics
    hist(grad[1:m],nclass=200,xlab=”degrees C/decade”,main=”GHCN adjustment change to trend”) # draw histogram
    a=c(mean(grad[1:m])); a # Mean slope change

    • RomanM

      Nick, I haven’t been ignoring your fine R script work. It is just that this post is in a side thread which I have been using to test features of HTML, etc. and was not intended to be used for comments.

      I haven’t figured out how to move it to the relevant thread yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s