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
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
__
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
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
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
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
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
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://
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://
#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
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
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
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
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
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
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
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
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
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]]
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
-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
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
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
(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()
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/)
##
.
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
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
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
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
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
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]]
___
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]]
___
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.
_
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
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
_
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
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
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
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
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()
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
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
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(
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
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
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
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
.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
)
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,
), 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
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]
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
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 <-
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
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
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
56 matches
Mail list logo