Re: [R] Downloading xls with active batons

2015-07-04 Thread Peter Maclean
developed country. Peter Maclean Department of Economics University of Dar-es-Salaam, Tanzania. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

Re: [R] Technological/Logistic Substitution Model

2014-07-24 Thread Peter Maclean
b and tc are time periods during which the technology i starts to enter the saturation and decline phase, respectively.   Any suggestion, reading is helpful.   Peter Maclean Department of Economics UDSM __ R-help@r-project.org mailing list https://

Re: [R] Technological/Logistic substitution model.

2014-07-30 Thread Peter Maclean
tc are time periods during which the technology i starts to enter the saturation and decline phase, respectively. Any suggestion, reading will be appreciate.   Peter Maclean Department of Economics UDSM __ R-help@r-project.org mailing list https://

Re: [R] How to add a legend with symbols()

2014-08-28 Thread Peter Maclean
d = 0.9)) symbols(x, y, circles = r, inches = 0.2, bg = 1:N, fg = "blue", main = "") palette(op) abline(v=0, h=0) })   Peter Maclean Department of Economics UDSM __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/l

Re: [R] Synthestic Control Methods for Causal Inference

2014-11-12 Thread Peter Maclean
units. Is there any package I have missed? I am currently doing a sequential analysis comparing each treated unit to the 35 untreated units. I would like to get a composite result. Any help will be appreciated. Sincerely, Peter Maclean Department of Economics UDSM

Re: [R] Extracting Current and Old Date

2013-07-28 Thread Peter Maclean
2004-02-13")) #Days between most current and old dayte days <- as.numeric(mostcurrent - olddate)   Peter Maclean Department of Economics UDSM [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch

Re: [R] GO TO function in R

2013-08-01 Thread Peter Maclean
ape, scale = scale) plot(x, y, type="b",col=" dark red", lwd=5) dev.off() #Step 3 Sys.sleep(2) Again in the model it is one hour #I Want to go back to step 1 to start over again Sincerely, Peter Maclean Department of Economics UDSM [[alternative HTML version deleted]]

Re: [R] Storing Big Matrix in R memory

2013-08-26 Thread Peter Maclean
tes(obj[x,]), longlat))) } SWMD <- big.matrix(DistMatrix(data)) data2 <- cbind(data, SWMD) With thanks Peter Maclean Department of Economics UDSM [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz

Re: [R] Recursive file Download from FTP

2013-01-16 Thread Peter Maclean
t;ftp://ftp.cpc.ncep.noaa.gov/fews/AFR_CLIM/ARC2/DATA/1985/"; filenames = getURL(url, ftp://ftp.use.epsv/ = FALSE, dirlistonly = TRUE) crlf = TRUE Peter Maclean Department of Economics UDSM [[alternative HTML version deleted]] __ R-help@r-project.org mailing

Re: [R] Recursive file Download from FTP

2013-01-16 Thread Peter Maclean
.   library(RCurl) # Download the files for 1985. url = "ftp://ftp.cpc.ncep.noaa.gov/fews/AFR_CLIM/ARC2/DATA/1985/"; filenames = getURL(url, ftp://ftp.use.epsv/ = FALSE, dirlistonly = TRUE) crlf = TRUE Peter Maclean Department of Economics UDSM [[alternative HTML versi

Re: [R] Recursive file Download from FTP Error

2013-01-27 Thread Peter Maclean
x27;)     targetfile <- paste(targetlink, filename, sep = '')     download.file(sourcefile, targetfile, cacheOK = TRUE, quiet = FALSE)       } # subfolders   for (dirname in dirs) {     fdownload(dirname)   } } # Call the function   fdownload(ftp://ftp.root/)   ##

Re: [R] xyplot help

2013-02-20 Thread Peter Maclean
(ndata) max <- max(ndata$prec, na.rm=TRUE) min <- min(ndata$prec, na.rm=TRUE)   #Plot the graph and save as pdf pdf("H:/file.pdf")   xyplot(prec~month|year+lon+lat, data=ndata,    type = c("l", "l","p"), ylim=c(min, max),    layout=c(1,4)) dev.off()  

Re: [R] Help xyplot

2013-02-22 Thread Peter Maclean
y Mackay suggestion pdf("H:/file.pdf") library(latticeExtra) useOuterStrips( xyplot(prec~month|year*paste(lat,lon), data=ndata, as.table = T, type = c("l", "l","p"), ylim=c(min, max), layout=c(1,4)) ) dev.off()#The actual data have more than 5 thou

Re: [R] (no subject)

2013-03-06 Thread Peter Maclean
in this subjet (including creating weights from strata and sampling unit variables) will be helpful. For example if analyzing data clustered in schools, how to use student's sampling weight or school sampling weight or both?  Peter Maclean Department of Economics UDSM [[altern

Re: [R] Error after R and Twitter Successfull Handshake

2013-03-27 Thread Peter Maclean
-verify-failed   http://stackoverflow.com/questions/7411215/oauth-authentication-with-twitter-api-failed   Peter Maclean Department of Economics UDSM [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch

Re: [R] Executing SAS Codes in R

2012-11-07 Thread Peter Maclean
Is there a way of executing SAS codes in R environment?   Peter Maclean Department of Economics UDSM [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] Executing SAS Codes in R

2012-11-08 Thread Peter Maclean
SAS code.  Peter Maclean Department of Economics UDSM [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting

Re: [R] Polychoric Principal Component Analysis (pPCA)

2013-12-17 Thread Peter Maclean
nfactors = 3, rotate = "Promax") #Do not work PCA(responses, scale.unit=TRUE, ncp=3, graph=T) #How to conduct polychoric principal component analysis using either of #the above package and producing individual and variable factor maps as #abo

Re: [R] Removing unused parameter in qqplot

2014-01-06 Thread Peter Maclean
y..)) +      geom_histogram(colour = "darkgreen", fill = "blue", binwidth = 0.5)       Peter Maclean Department of Economics UDSM __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the p

[R] shading and estimating area abetween two cdf curves

2014-01-17 Thread Peter Maclean
#calculate the area between the two curves Peter Maclean Department of Economics UDSM __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and

Re: [R] Importing odf file into R

2013-10-03 Thread Peter Maclean
Anyone aware of a package or technique to import odf data file into R, I will appreciate his/her help. Peter Maclean Department of Economics UDSM [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch

Re: [R] Geocode Conversion

2013-10-23 Thread Peter Maclean
10:811S 31:37:760E        8:06:040S 31:41:190E        8:06:557S 31:41:229E        8:06:622S 31:38:891E        8:06:281S I am using gmt package for geocodes conversion. I will appreciate any help. Peter Maclean Department of Economics UDSM [[alternative HTML ve

Re: [R] Code Book from SPSS Data

2013-10-27 Thread Peter Maclean
    1=Married    Marital status    2=Widow    3=Others Peter Maclean Department of Economics UDSM On Sunday, October 27, 2013 3:32 AM, Barry Rowlingson wrote: On Sat, Oct 26, 2013 at 9:37 PM, Peter Maclean wrote: > I do not have SPSS and I

Re: [R] Cross Tabulation

2013-11-10 Thread Peter Maclean
quot;yes", "no", "yes", "yes", "no", "yes", "no", "yes","no") cost <- runif(12, 5.0, 9) var <- c("region", "response", "district") data <- data.frame(region, district, respon

Re: [R] Stochastic Dominance Analysis

2013-12-10 Thread Peter Maclean
Do anyone now R packages that run/test stochastic dominance with respect to a function (SDRF) and/or stochastic efficiency with respect to a function (SERF)? Peter Maclean Department of Economics UDSM [[alternative HTML version deleted]] __ R

Re: [R] legend position in interaction.plot

2011-08-11 Thread Peter Maclean
How do I move the legend from default position (right and within the plot) to the "bottomleft" of the plot?   interaction.plot(YEAR, ID GROWTH, legend=TRUE, col = 2:7,xlab="Year",    ylim=c(0,2), ylab="Growth",leg.bty = "o") Pe

Re: [R] Legent to the Periodogram

2011-08-27 Thread Peter Maclean
y.spc<-spec.pgram(y.time, spans = c(3,3), detrend=FALSE,log="no",plot = TRUE, kernel("modified.daniell", c(5,7))) plot(y.spc, plot.type = "marginal", main="Smoothed Periodogram") Peter Maclean Department of Economics UDSM _

Re: [R] add a legend to a periodogram

2011-08-31 Thread Peter Maclean
Hi: Trying for hours to add a legend to a periodogram. Any help will be appreciated. For example, how can I add a legent (showing x1, x2, x3, x4) to both plots (generated by spec.program() and plot()? Here is a worked example. require(TSA) require(graphics) require(stats) t<-1986:2011 x1<-cos(t*1

Re: [R] Indexing Grouped Data

2012-06-13 Thread Peter Maclean
  id age dose 1  1   4  1.8 2  2   5  1.8 3  2  10  1.6 4  2  12  1.2 5  3   4  1.8 6  3   6  1.6 7  4   2  1.8 > df2   id age ind dose 1  1   4   1  1.8 2  2   5   1  1.8 3  2  10   2  1.6 4  2  12   3  1.2 5  3   4   1  1.8 6  3   6   2  1.6 7  4   2   1  1.8 > Peter Maclean Department o

Re: [R] BY GROUP IN GEV

2011-06-22 Thread Peter Maclean
I am trying to run gev (general extreme value) function in “evir” package. My data is divided by state. I am using the following codes but it is not working. I will appreciate any help.   #Split data MAS <- split(MA, MA$states)   CP  <- lapply(MAS, function(x){gev(MAS$CP1, 100, method = "BFGS", c

Re: [R] BY GROUP IN GEV

2011-06-27 Thread Peter Maclean
Hi Dennis: I tried your suggestions and I am getting the following errors: Error in x$CP1 : $ operator is invalid for atomic vectors In addition: Warning message: In sqrt(diag(varcov)) : NaNs produced  Peter Maclean Department of Economics UDSM - Original Message From: Dennis Murphy

Re: [R] BY GROUP IN GEV

2011-06-29 Thread Peter Maclean
Dennis: It walks for small datset.  Peter Maclean Department of Economics UDSM - Original Message From: Dennis Murphy To: Peter Maclean Cc: r-help@r-project.org Sent: Mon, June 27, 2011 8:37:00 PM Subject: Re: [R] BY GROUP IN GEV HI: Since you didn't provide a reprodu

Re: [R] DROP OBSEVATION IN A GROUP

2011-06-29 Thread Peter Maclean
People with more experience in R I need help on this. I would like to drop observation if they meet certain condition. In this example I would like to drop group 2 in "n" because the group in "Y" has more than 2 zeroes.  #Example n <- c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,3) y <-

Re: [R] Saving fExtremes estimates and k-block return level with confidence intervals.

2011-06-29 Thread Peter Maclean
I am estimating a large model by groups. How do you save the results and returns the associated quantiles? For this example I need a data frame n    xi    mubeta 1   0.1033614  2.5389580 0.9092611 2   0.3401922  0.5192882 1.5290615 3   0.5130798  0.5668308 1.2105666 I also want to

Re: [R] DROP OBSEVATION IN A GROUP

2011-06-29 Thread Peter Maclean
I tried this but did not work: z0<- by(z, z[,"n"], function(x) subset(x, sum(n==0)>2))  Peter Maclean Department of Economics UDSM - Original Message From: Duncan Murdoch To: Peter Maclean Cc: r-help@r-project.org Sent: Wed, June 29, 2011 3:33:25 PM Subject: Re: [R]

Re: [R] Saving fExtremes estimates and k-block return level with confidence intervals.

2011-06-30 Thread Peter Maclean
), t(sapply(res2, function(l) l@fit$par.ests))) for the first part. HTH, Jorge On Thu, Jun 30, 2011 at 12:16 AM, Peter Maclean <> wrote: I am estimating a large model by groups. How do you save the results and returns >the associated quantiles? >For this example I need a data fr

Re: [R] BY GROUP in evir R package

2011-07-06 Thread Peter Maclean
) require(plyr) #Model for Grouped rg2<- by(Gdata,Gdata[,"n"], function(x) gev(x$y, 5, method = "BFGS", control =list(maxit = 500))) # rl <- rlevel.gev(rg2, k.blocks = 5, add = TRUE)   - Original Message From: Dr. Bernhard Pfaff To: Peter Maclean Sent: Fri,

Re: [R] Saving fExtremes estimates and k-block return level with confidence intervals.

2011-07-06 Thread Peter Maclean
.gev" function to get the values?     #Model for single vector rlf <- gevFit(y, block = 2, type = "mle") rlfp <- gevrlevelPlot(rlf, kBlocks = 2) rlfp rle <- gev(y, 2, method = "BFGS", control =list(maxit = 1)) rlep<- rlevel.gev(rle, k.blocks = 2, ad

Re: [R] BY GROUP in evir R package

2011-07-06 Thread Peter Maclean
Dr. Pfaff: After using str; can you give an example on data extration (e.g. for $par.ests and @residuals) - Original Message From: "Pfaff, Bernhard Dr." To: Peter Maclean ; Dr. Bernhard Pfaff Cc: "r-help@r-project.org" Sent: Wed, July 6, 2011 8:17:12 AM Subje

Re: [R] Split a row vector into columns

2011-07-06 Thread Peter Maclean
I want to create columns from this row vector. From:     x1 x2 x3 x1 x2 x3 x1 x2 x3 1  2 3  1  2  3  1   2  3 to: x1 x2 x3 1  2   3 1  2   3 1  2   3 Peter Maclean Department of Economics UDSM __ R-help@r-project.org mailing list https

Re: [R] Split a row vector into columns

2011-07-06 Thread Peter Maclean
That is what I wanted  Peter Maclean Department of Economics UDSM - Original Message From: Sarah Goslee To: Peter Maclean Cc: r-help@r-project.org Sent: Wed, July 6, 2011 1:15:31 PM Subject: Re: [R] Split a row vector into columns You mean like: > myvec <- c(1,2,3,1,2,3

Re: [R] Substring a column vector

2011-07-06 Thread Peter Maclean
How to substring the following vector (in data frame b) >b a 11 12 1234 1245 124567 126786 145769 such that: a1    a2 1 1 1 2 12    23 12    34 124   567 126   787 145   769   I tried logical commands with substr() did not work out. __ R-help@r

Re: [R] Return Level in "ismev"

2011-07-09 Thread Peter Maclean
Is is possible to recover the return levels and intervals (as reported in a turn level plot) at a given confidence interval? See a repducible example. #Grouped vector n <- data.frame(n = rep(c(1:3), each = 10)) y = rgamma(30, shape=0.5, rate = 1, scale = 10) require(plyr) require(ismev) require(

Re: [R] fitdistr() Error

2011-07-11 Thread Peter Maclean
I am trying to estimate a gamma function using real data and I am getting the following error messages. When I set a lower limit; the error message is "L-BFGS-B needs finite values of fn"   For other method the error message is: Error in optim(x = c(0.1052867, 0.3472275, 2.057625, 0.32967

Re: [R] fitdistr() Error

2011-07-12 Thread Peter Maclean
There is no missing value nor zero values.   - Original Message From: Uwe Ligges To: Peter Maclean Cc: r-help@r-project.org Sent: Tue, July 12, 2011 2:58:10 AM Subject: Re: [R] fitdistr() Error Any NA values or values outside the support region of your distribution? UWe On

Re: [R] glm() scale parameters and predicted Values

2011-07-13 Thread Peter Maclean
In glm() you can use the summary() function to recover the shape parameter (the reciprocal of the dispersion parameter). How do you recover the scale parameter? Also, in the given example, how I estimate and save the geometric mean of the predicted values? For a simple model you can use fitted()

Re: [R] FOMULATING TIME SERIES DATA FROM DATA FRAME

2011-07-16 Thread Peter Maclean
rder.by =year, frequency = 1)   #Error in xts(coredata(x), order.by = order.by, frequency = frequency,  :  # order.by requires an appropriate time-based object Peter Maclean Department of Economics UDSM __ R-help@r-project.org mailing list https://sta

Re: [R] Spectral/Frequency Domain Analysis in R

2011-07-30 Thread Peter Maclean
I am looking for introductory/published papers on spectral analysis\Frequency domain analysis for both univariate and multivariate Time Series data that use R-preferabily climate or economic data. I have some but most of them are not for begginers.   Peter Maclean Department of Economics UDSM

Re: [R] Spatial Data Interpolation

2011-07-30 Thread Peter Maclean
ata,ndata, by=c("year", "period", "lat","lon"))) fix(data) ## #Spatial-Temporal Interpolation from original data (temp & rain) to new data Peter Maclean Department of Economics UDSM __ R-help@r-project.org m

Re: [R] HELP DATA CLIPPING AND DATA OVERLAY ON A MAP

2011-11-16 Thread Peter Maclean
main="TZA Regions") #How do I clipp or overaly X in data on TZA_adm2 polygon? #Also how to remove the legent or putting the names in the map. auto.key=FALSE does not work.   Peter Maclean Department of Economics UDSM [[alternative HTML version deleted]] ___

Re: [R] Small Area Estimate Using Structural Equation Models

2011-09-23 Thread Peter Maclean
I am looking for study materisl on how to conduct 'small area estimation' using structural equations models in R for both longtudinal and repeated cross-section data. Tried google did not work. There are other regression technique my interest is on structural equation models.  _

Re: [R] spi in SPEI package

2011-10-22 Thread Peter Maclean
as.data.frame(spi(data, 3, kernel=list(type ='rectangular', shift=0), distribution='Gamma', fit='max-lik', na.rm=FALSE)) Peter Maclean Department of Economics UDSM [[alternative HTML version deleted]] ___

Re: [R] Double Roop

2015-06-30 Thread Peter Maclean via R-help
or(j in 1:length(a)) {    for(i in 1:length(b)){    pre[j]  <- strsplit(a[j],"-")[[1]][1]   post[j] <- strsplit(a[j],"-")[[1]][2]     page[i] <- paste0(pre[j], b[i],post[j])  }}Peter Maclean Department of Economics UDSM [[alternative HTML

Re: [R] Eye Diagram from a Topic Model

2015-07-25 Thread Peter Maclean via R-help
Is it possible to reproduce the eye-diagram described here from the topic model/ https://github.com/ouzor/eyediagram/blob/master/example.R and shown here: https://github.com/ouzor/eyediagram/blob/master/example/ExampleEyeDiagram.pdf The code do not work in processing as suggested by the author

Re: [R] Recover value from boot and quantile function

2015-10-29 Thread Peter Maclean via R-help
mma(100,2,1) x.boot <- boot(x, function(y,i) mean(y[i]), R=1000) x.boot hist(x.boot$t) str(x.boot) x.quant <- quantile(x.boot$t, p=c(0.025, 0.975)) x.quant x.quant[1:2] str(x.quant) Peter Maclean Department of Economics UDSM #Create table/data frame __

Re: [R] Fixing Parameters in maxLik

2015-11-14 Thread Peter Maclean via R-help
Is there a way in maxLik to fix/constraint a parameter to fall within a certain range ? For example I want sigma to be always between 1.98 and 2.02 library(maxLik) loglik <- function(param) { mu <- param[1] sigma <- param[2] ll <- -0.5*N*log(2*pi) - N*log(sigma) - sum(0.5*(x - mu)^2/sigma