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 -

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] 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] Downloading xls with active batons

2015-07-04 Thread Peter Maclean
and a 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] Double Roop

2015-06-30 Thread Peter Maclean via R-help
]  - 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 version deleted]] __ R-help@r-project.org mailing list

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] How to add a legend with symbols()

2014-08-28 Thread Peter Maclean
, 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/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

Re: [R] Technological/Logistic substitution model.

2014-07-30 Thread Peter Maclean
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://stat.ethz.ch/mailman

Re: [R] Technological/Logistic Substitution Model

2014-07-24 Thread Peter Maclean
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

[R] shading and estimating area abetween two cdf curves

2014-01-17 Thread Peter Maclean
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 provide commented, minimal, self-contained

Re: [R] Removing unused parameter in qqplot

2014-01-06 Thread Peter Maclean
- as.data.frame(rep(18, 9)) colnames(x4) - c(name) dat - rbind.data.frame(x1, x2, x3, x4) dat - as.data.frame(dat) colnames(data) - c(name) fix(dat) require(ggplot2) ggplot(dat , aes(x=name, y = ..density..)) + geom_histogram(colour = darkgreen, fill = blue, binwidth = 0.5)       Peter Maclean

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

2013-12-17 Thread Peter Maclean
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 #above Peter Maclean Department of Economics UDSM __ R-help

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] Cross Tabulation

2013-11-10 Thread Peter Maclean
not look good #How do i remove the NaN or create a better one prop.table(ftable(data1, exclude = c(NA, NaN)), 1) prop.table(ftable(xtabs(~region + district+ response, data=data)),1) Peter Maclean Department of Economics UDSM [[alternative HTML version deleted

Re: [R] Code Book from SPSS Data

2013-10-27 Thread Peter Maclean
   2=Widow    3=Others Peter Maclean Department of Economics UDSM On Sunday, October 27, 2013 3:32 AM, Barry Rowlingson b.rowling...@lancaster.ac.uk wrote: On Sat, Oct 26, 2013 at 9:37 PM, Peter Maclean pmaclean2...@yahoo.com wrote: I do not have SPSS and I would

Re: [R] Geocode Conversion

2013-10-23 Thread Peter Maclean
: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 version deleted

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] Storing Big Matrix in R memory

2013-08-26 Thread Peter Maclean
- 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.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] GO TO function in R

2013-08-01 Thread Peter Maclean
#I Want to go back to step 1 to start over again Sincerely, 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

Re: [R] Extracting Current and Old Date

2013-07-28 Thread Peter Maclean
)   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-guide.html

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] (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 [[alternative

Re: [R] Help xyplot

2013-02-22 Thread Peter Maclean
)) ) dev.off()#The actual data have more than 5 thousand data points, Just want to plot a few #selected randomly. Also, if I can put 5 data points (nearest grids) in one graph #will be more helpful. Peter Maclean Department of Economics UDSM [[alternative HTML version deleted

Re: [R] xyplot help

2013-02-20 Thread Peter Maclean
= c(l, l,p), ylim=c(min, max),    layout=c(1,4)) dev.off()   ## #I want to remove the lat and lon rows and put the numbers inside the graph Peter Maclean Department of Economics UDSM

Re: [R] Recursive file Download from FTP Error

2013-01-27 Thread Peter Maclean
  for (dirname in dirs) {     fdownload(dirname)   } } # Call the function   fdownload(ftp://ftp.root/)   ##  I could not find any solution from the web. I will appreciate any help Peter Maclean Department of Economics UDSM [[alternative HTML

Re: [R] Recursive file Download from FTP

2013-01-16 Thread Peter Maclean
/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 list https

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 version deleted

Re: [R] Executing SAS Codes in R

2012-11-08 Thread Peter Maclean
by the 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] 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

Re: [R] Indexing Grouped Data

2012-06-13 Thread Peter Maclean
  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 of Economics UDSM [[alternative HTML version

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

2011-11-16 Thread Peter Maclean
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]] __ R-help@r-project.org mailing list https

Re: [R] spi in SPEI package

2011-10-22 Thread Peter Maclean
(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]] __ R-help@r-project.org mailing list https://stat.ethz.ch

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] Legent to the Periodogram

2011-08-27 Thread Peter Maclean
, 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 __ R-help@r-project.org mailing list https://stat.ethz.ch

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) Peter Maclean Department of Economics UDSM

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
original data (temp rain) to new data 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 provide

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

2011-07-16 Thread Peter Maclean
)   #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://stat.ethz.ch/mailman/listinfo/r-help

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

Re: [R] fitdistr() Error

2011-07-12 Thread Peter Maclean
There is no missing value nor zero values.   - Original Message From: Uwe Ligges lig...@statistik.tu-dortmund.de To: Peter Maclean pmaclean2...@yahoo.com 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

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,

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)

Re: [R] BY GROUP in evir R package

2011-07-06 Thread Peter Maclean
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 bernh...@pfaffikus.de To: Peter Maclean pmaclean2...@yahoo.com Sent: Fri, June 3, 2011 2:45

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

2011-07-06 Thread Peter Maclean
, control =list(maxit = 1)) rlep- rlevel.gev(rle, k.blocks = 2, add = FALSE) rlep - Original Message From: Dennis Murphy djmu...@gmail.com To: Peter Maclean pmaclean2...@yahoo.com Sent: Thu, June 30, 2011 3:03:05 PM Subject: Re: [R] Saving fExtremes estimates and k-block return level

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. bernhard_pf...@fra.invesco.com To: Peter Maclean pmaclean2...@yahoo.com; Dr. Bernhard Pfaff bernh...@pfaffikus.de Cc: r-help@r

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 sarah.gos...@gmail.com To: Peter Maclean pmaclean2...@yahoo.com 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

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. __

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

2011-06-30 Thread Peter Maclean
Peter, Try  data.frame(n = names(res2), 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

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 djmu...@gmail.com To: Peter Maclean pmaclean2...@yahoo.com Cc: r-help@r-project.org Sent: Mon, June 27, 2011 8:37:00 PM Subject: Re: [R] BY GROUP IN GEV HI: Since

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 murdoch.dun...@gmail.com To: Peter Maclean pmaclean2...@yahoo.com Cc: r-help@r-project.org Sent: Wed, June 29, 2011 3

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-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,