Re: [R] creat contingency tables with fixed row and column margins

2017-05-27 Thread David Winsemius

> On May 27, 2017, at 1:54 PM, li li  wrote:
> 
> I meant that the post in your link above was NOT asked by me.
> 
> 2017-05-27 16:53 GMT-04:00 li li :
> Hi Dave,
>   Thanks for your reply but the post in your link above was certainly asked 
> by me.
>Hanna
> 

I really have no idea what either of those sentences above might mean. I 
offered what I thought was one obvious effort at searching for a method to 
accomplish the task set forth in you subject line, but was leaving it up to you 
to take steps forward to advance the process. It might also help to explain the 
purpose of this effort.

-- 
David.

> 2017-05-27 16:04 GMT-04:00 David Winsemius :
> 
> > On May 27, 2017, at 12:49 PM, li li  wrote:
> >
> > Hi all,
> >  Is there an R function that can be used to enumerate all the contingency
> > tables with fixed row and column margins. For example, can we list all 3 by
> > 3 tables with row margins 3,6,6 and column margins 5,5,5.
> 
> The Posting Guide suggests that you describe the results of your efforts at 
> searching:
> 
> https://www.google.com/search?q=use+r%3Alang+to+enumerate+contingency+tables+with+fixed+margins&oq=use+r%3Alang+to+enumerate+contingency+tables+with+fixed+margins&aqs=chrome..69i57.35014j0j4&sourceid=chrome&ie=UTF-8
> 
> >   Thanks very much!
> >   Hanna
> >
> >   [[alternative HTML version deleted]]
> 
> And (yet again) you are asked to post in plain text.
> >
> > __
> > 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://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> 
> David Winsemius
> Alameda, CA, USA
> 
> 
> 

David Winsemius
Alameda, CA, USA

__
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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Need Help To Solve An Equation In R

2017-05-27 Thread Bert Gunter
Then:

1. Always cc the list;

2. Read and follow the posting guide: no HTML, plain text only.


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Sat, May 27, 2017 at 11:05 AM, Neetu Shah  wrote:
> Dear Sir,
>
> It is not homework. I am trying to develop a library in R as my project. My
> mentor said to ask this doubt on R forum. As I am not able to solve that
> equation in R. I need to know the alternative for uniroot function. Please
> help me regarding this.
>
>
> --
> With Regards,
> Neetu Shah,
> B.Tech.(CS),
> 3rd Year,
> IIIT Vadodara.
>
>
> On Sat, May 27, 2017 at 11:11 PM, Bert Gunter 
> wrote:
>>
>> Homework? We generally don't do homework here.
>>
>> Cheers,
>> Bert
>> Bert Gunter
>>
>> "The trouble with having an open mind is that people keep coming along
>> and sticking things into it."
>> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>>
>>
>> On Sat, May 27, 2017 at 9:16 AM, Neetu Shah  wrote:
>> > Dear Sir/Ma'am,
>> >
>> > I am trying to make a function to solve an equation that is given below:
>> > findH <- function(p_star, k){
>> > fun <- function(y){
>> > (pnorm(y+h))^(k-1)*dnorm(y)
>> > }
>> > lhs <- integrate(fun, -Inf, Inf)$value
>> > return(uniroot(lhs, lower = -10, upper = 10,
>> > tol = p_star)$root)
>> > }
>> > In lhs, I integrated a function with respect to y and there would be an
>> > unknown h that I need to find.
>> > I need to equate this lhs to p_star value in order to find h. Which
>> > function should I use to solve this equation?
>> > Please guide me regarding this.
>> > Thank you.
>> >
>> > --
>> > With Regards,
>> > Neetu Shah,
>> > B.Tech.(CS),
>> > 3rd Year,
>> > IIIT Vadodara.
>> >
>> > [[alternative HTML version deleted]]
>> >
>> > __
>> > 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://www.R-project.org/posting-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>
>
>
>
>

__
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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] rollapply() produces NAs

2017-05-27 Thread Sepp via R-help
Hello,
I am fairly new to R and trying to calculate value at risk with exponentially 
decreasing weights.My function works for a single vector of returns but does 
not work with rollapply(), which is what I want to use. The function I am 
working on should assig exponentially decreasing weights to the K most recent 
returns and then order the returns in an ascending order. Subsequently it 
should pick the last return for which the cumulative sum of the weights is 
smaller or equal to a significance level. Thus, I am trying to construct a 
cumulative distribution function and find a quantile.
This is the function I wrote:
VaRfun <- function(x, lambda = 0.94) {
#create data.frame and order returns such that the lates return is the first  
df <- data.frame(weight = c(1:length(x)), return = rev(x))  K <- nrow(df)  
constant <- (1-lambda)/(1-lambda^(K))#assign weights to the returns    for(i in 
1:nrow(df)) {    df$weight[i] <- lambda^(i-1) * constant    }#order returns in 
an ascending order  df <- df[order(df$return),]
#add the cumulative sum of the weights  df$cum.weight <- cumsum(df$weight)
#calculate value at risk  VaR <- -tail((df$return[df$cum.weight <= .05]), 1)  
signif(VaR, digits = 3)}
It works for a single vector of returns but if I try to use it with 
rollapply(), such as
rollapply(r, width = list(-500, -1), FUN = VaRfun),
it outputs a vector of NAs and I don't know why.
Thank you for your help!
[[alternative HTML version deleted]]

__
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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Need Help To Solve An Equation In R

2017-05-27 Thread Bert Gunter
Homework? We generally don't do homework here.

Cheers,
Bert
Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Sat, May 27, 2017 at 9:16 AM, Neetu Shah  wrote:
> Dear Sir/Ma'am,
>
> I am trying to make a function to solve an equation that is given below:
> findH <- function(p_star, k){
> fun <- function(y){
> (pnorm(y+h))^(k-1)*dnorm(y)
> }
> lhs <- integrate(fun, -Inf, Inf)$value
> return(uniroot(lhs, lower = -10, upper = 10,
> tol = p_star)$root)
> }
> In lhs, I integrated a function with respect to y and there would be an
> unknown h that I need to find.
> I need to equate this lhs to p_star value in order to find h. Which
> function should I use to solve this equation?
> Please guide me regarding this.
> Thank you.
>
> --
> With Regards,
> Neetu Shah,
> B.Tech.(CS),
> 3rd Year,
> IIIT Vadodara.
>
> [[alternative HTML version deleted]]
>
> __
> 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://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] creat contingency tables with fixed row and column margins

2017-05-27 Thread Jeff Newmiller
Ah, but the point is that you did not say why  those search results did not 
address your question, since if they DID answer your question then why should 
we have to be doing your searching for you? 
-- 
Sent from my phone. Please excuse my brevity.

On May 27, 2017 1:54:18 PM PDT, li li  wrote:
>I meant that the post in your link above was NOT asked by me.
>
>2017-05-27 16:53 GMT-04:00 li li :
>
>> Hi Dave,
>>   Thanks for your reply but the post in your link above was certainly
>> asked by me.
>>Hanna
>>
>> 2017-05-27 16:04 GMT-04:00 David Winsemius :
>>
>>>
>>> > On May 27, 2017, at 12:49 PM, li li  wrote:
>>> >
>>> > Hi all,
>>> >  Is there an R function that can be used to enumerate all the
>>> contingency
>>> > tables with fixed row and column margins. For example, can we list
>all
>>> 3 by
>>> > 3 tables with row margins 3,6,6 and column margins 5,5,5.
>>>
>>> The Posting Guide suggests that you describe the results of your
>efforts
>>> at searching:
>>>
>>> https://www.google.com/search?q=use+r%3Alang+to+enumerate+co
>>> ntingency+tables+with+fixed+margins&oq=use+r%3Alang+to+enume
>>> rate+contingency+tables+with+fixed+margins&aqs=chrome..
>>> 69i57.35014j0j4&sourceid=chrome&ie=UTF-8
>>>
>>> >   Thanks very much!
>>> >   Hanna
>>> >
>>> >   [[alternative HTML version deleted]]
>>>
>>> And (yet again) you are asked to post in plain text.
>>> >
>>> > __
>>> > 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://www.R-project.org/posti
>>> ng-guide.html
>>> > and provide commented, minimal, self-contained, reproducible code.
>>>
>>> David Winsemius
>>> Alameda, CA, USA
>>>
>>>
>>
>
>   [[alternative HTML version deleted]]
>
>__
>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://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

__
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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] creat contingency tables with fixed row and column margins

2017-05-27 Thread li li
I meant that the post in your link above was NOT asked by me.

2017-05-27 16:53 GMT-04:00 li li :

> Hi Dave,
>   Thanks for your reply but the post in your link above was certainly
> asked by me.
>Hanna
>
> 2017-05-27 16:04 GMT-04:00 David Winsemius :
>
>>
>> > On May 27, 2017, at 12:49 PM, li li  wrote:
>> >
>> > Hi all,
>> >  Is there an R function that can be used to enumerate all the
>> contingency
>> > tables with fixed row and column margins. For example, can we list all
>> 3 by
>> > 3 tables with row margins 3,6,6 and column margins 5,5,5.
>>
>> The Posting Guide suggests that you describe the results of your efforts
>> at searching:
>>
>> https://www.google.com/search?q=use+r%3Alang+to+enumerate+co
>> ntingency+tables+with+fixed+margins&oq=use+r%3Alang+to+enume
>> rate+contingency+tables+with+fixed+margins&aqs=chrome..
>> 69i57.35014j0j4&sourceid=chrome&ie=UTF-8
>>
>> >   Thanks very much!
>> >   Hanna
>> >
>> >   [[alternative HTML version deleted]]
>>
>> And (yet again) you are asked to post in plain text.
>> >
>> > __
>> > 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://www.R-project.org/posti
>> ng-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>>
>> David Winsemius
>> Alameda, CA, USA
>>
>>
>

[[alternative HTML version deleted]]

__
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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] creat contingency tables with fixed row and column margins

2017-05-27 Thread li li
Hi Dave,
  Thanks for your reply but the post in your link above was certainly asked
by me.
   Hanna

2017-05-27 16:04 GMT-04:00 David Winsemius :

>
> > On May 27, 2017, at 12:49 PM, li li  wrote:
> >
> > Hi all,
> >  Is there an R function that can be used to enumerate all the contingency
> > tables with fixed row and column margins. For example, can we list all 3
> by
> > 3 tables with row margins 3,6,6 and column margins 5,5,5.
>
> The Posting Guide suggests that you describe the results of your efforts
> at searching:
>
> https://www.google.com/search?q=use+r%3Alang+to+enumerate+
> contingency+tables+with+fixed+margins&oq=use+r%3Alang+to+
> enumerate+contingency+tables+with+fixed+margins&aqs=chrome.
> .69i57.35014j0j4&sourceid=chrome&ie=UTF-8
>
> >   Thanks very much!
> >   Hanna
> >
> >   [[alternative HTML version deleted]]
>
> And (yet again) you are asked to post in plain text.
> >
> > __
> > 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://www.R-project.org/
> posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> David Winsemius
> Alameda, CA, USA
>
>

[[alternative HTML version deleted]]

__
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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Latin Hypercube Sampling when parameters are defined according to specific probability distributions

2017-05-27 Thread Rob C
>May 26, 2017; 11:41am  Nelly Reduan Latin Hypercube Sampling when parameters 
>are >defined according to specific probability distributions
>Hello,
> I would like to perform a sensitivity analysis using a Latin Hypercube 
> Sampling (LHS).
>Among the input parameters in the model, I have a parameter dispersal distance 
>which is defined according to an exponential probability distribution.

>In the model, the user thus sets a default probability value for each distance 
>class.

>For example, for distances ([0  2]; ]2  4]; ]4  6]; ]6  8]; ]8  10];; ]48  50],

>respective probabilities are 0.055; 0.090; 0.065; 0.035; 0.045;; 0.005.

 >Here is the code to represent an exponential probability
distribution for the parameter dispersal distance:

>set.seed(0)
>foo <- rexp(100, rate = 1/10)
>hist(foo, prob=TRUE, breaks=20, ylim=c(0,0.1), xlab ="Distance (km)")
>lines(dexp(seq(1, 100, by = 1), rate = 1/mean(foo)),col="red")
>1/mean(foo)

>When a parameter is defined according to a specific probability distribution, 
>how can I perform a LHS ?
>For example, should I sample N values from a uniform distribution for each 
>distance class (i.e., [0 � 2]; ]2 � 4]; ]4 � 6]; ]6 � 8]; ]8 � 10];��; ]48 � 
>50])
>or sample N values from exponential distributions with different rates ?

>Here is the code used to perform a LHS when the parameter �dispersal distance� 
>is defined by one default value in the model:

>library(pse)
>factors <- c("distance")
>q <- c("qexp")
>q.arg <- list( list(rate=1/30) )
>uncoupledLHS <- LHS(model=NULL, factors, 50, q, q.arg)
>head(uncoupledLHS)

>Thanks a lot for your time.
>Have a nice day
>Nell

Nell,

I would like to suggest a slightly different method for generating the
sample using the lhs library,  then I will try using the pse library.
Generally when you have a package specific
question, you should try to contact the package maintainer first.

set.seed(1)
# I don't think your model has only one parameter, so I will include multiple
input_parameters <- c("dispersal_distance", "temperature", "pressure")
N <- 50
exponential_rate <- 1/30

library(lhs)
X <- randomLHS(N, length(input_parameters))
dimnames(X) <- list(NULL, input_parameters)
# X is now a uniformly distributed Latin hypercube
head(X)
hist(X[,1], breaks=5)
hist(X[,2], breaks=5)
hist(X[,3], breaks=5)
# now, transform the dispersal_distance paramter to an exponential sample
Y <- X
Y[,"dispersal_distance"] <- qexp(X[,"dispersal_distance"],
rate=exponential_rate)
hist(Y[,1], breaks=10)
# you can transform the other marginals as required and then assess
function sensitivity
model_function <- function(z) z[1]*z[2] + z[3]
apply(Y, 1, model_function)

# now, trying to use pse
library(pse)
q <- list("qexp", "qunif", "qunif")
q.arg <- list(list(rate=exponential_rate), list(min=0, max=1),
list(min=0, max=1))
uncoupledLHS <- LHS(model=model_function, input_parameters, N, q, q.arg)
hist(uncoupledLHS$data$dispersal_distance, breaks=10)

Rob

__
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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] creat contingency tables with fixed row and column margins

2017-05-27 Thread David Winsemius

> On May 27, 2017, at 12:49 PM, li li  wrote:
> 
> Hi all,
>  Is there an R function that can be used to enumerate all the contingency
> tables with fixed row and column margins. For example, can we list all 3 by
> 3 tables with row margins 3,6,6 and column margins 5,5,5.

The Posting Guide suggests that you describe the results of your efforts at 
searching:

https://www.google.com/search?q=use+r%3Alang+to+enumerate+contingency+tables+with+fixed+margins&oq=use+r%3Alang+to+enumerate+contingency+tables+with+fixed+margins&aqs=chrome..69i57.35014j0j4&sourceid=chrome&ie=UTF-8

>   Thanks very much!
>   Hanna
> 
>   [[alternative HTML version deleted]]

And (yet again) you are asked to post in plain text.
> 
> __
> 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://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

__
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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] creat contingency tables with fixed row and column margins

2017-05-27 Thread li li
Hi all,
  Is there an R function that can be used to enumerate all the contingency
tables with fixed row and column margins. For example, can we list all 3 by
3 tables with row margins 3,6,6 and column margins 5,5,5.
   Thanks very much!
   Hanna

[[alternative HTML version deleted]]

__
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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Need Help To Solve An Equation In R

2017-05-27 Thread David Winsemius

> On May 27, 2017, at 9:16 AM, Neetu Shah  wrote:
> 
> Dear Sir/Ma'am,
> 
> I am trying to make a function to solve an equation that is given below:
> findH <- function(p_star, k){
> fun <- function(y){
> (pnorm(y+h))^(k-1)*dnorm(y)
> }
> lhs <- integrate(fun, -Inf, Inf)$value
> return(uniroot(lhs, lower = -10, upper = 10,
> tol = p_star)$root)
> }
> In lhs, I integrated a function with respect to y and there would be an
> unknown h that I need to find.

uniroot needs a function as its first argument. `integrate(fun, -Inf, 
Inf)$value` does not return a function. it will return a numeric value (if it 
succeeds). 

I have no idea whether this makes any mathematical sense because you have not 
described the background for this effort and have not shown how you expect to 
call `findH`. Is `h` supposed to be some sort of non-centrality parameter with 
`k` representing degrees of freedom?

I tried this code that does run, although it fails gracefully at runtime:

findH <- function(p_star= 0.004, k=2){
   fun <- function(y,h){
(pnorm(y+h))^(k-1)*dnorm(y)
   }
lhs <- function(x) { integrate(fun, lower=-Inf, upper=Inf, h=x)$value }
return(uniroot(lhs, lower = -10, upper = 10, tol = p_star)$root)
}
#---
> findH(k=6)
Error in uniroot(lhs, lower = -10, upper = 10, tol = p_star) : 
  f() values at end points not of opposite sign



> I need to equate this lhs to p_star value in order to find h.

> Which
> function should I use to solve this equation?
> Please guide me regarding this.
> Thank you.
> 
> -- 
> With Regards,
> Neetu Shah,
> B.Tech.(CS),
> 3rd Year,
> IIIT Vadodara.
> 
>   [[alternative HTML version deleted]]
> 
> __
> 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://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

__
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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Need Help To Solve An Equation In R

2017-05-27 Thread Neetu Shah
Dear Sir/Ma'am,

I am trying to make a function to solve an equation that is given below:
findH <- function(p_star, k){
fun <- function(y){
(pnorm(y+h))^(k-1)*dnorm(y)
}
lhs <- integrate(fun, -Inf, Inf)$value
return(uniroot(lhs, lower = -10, upper = 10,
tol = p_star)$root)
}
In lhs, I integrated a function with respect to y and there would be an
unknown h that I need to find.
I need to equate this lhs to p_star value in order to find h. Which
function should I use to solve this equation?
Please guide me regarding this.
Thank you.

-- 
With Regards,
Neetu Shah,
B.Tech.(CS),
3rd Year,
IIIT Vadodara.

[[alternative HTML version deleted]]

__
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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problem with Example with Lattice

2017-05-27 Thread Bert Gunter
I was surprised this worked at all, as I usually use the formula interface.

Anyway, you need to explicitly specify the point types via the pch
argument.  The default uses trellis.par.get("dot.symbol"), which is
just a single value.


-- Bert



Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Sat, May 27, 2017 at 6:03 AM, Lorenzo Isella
 wrote:
> Dear All,
> I am making my baby steps with the lattice graphic system.
> I am going through the great book by Sarkar which provides plenty of
> examples.
> However, I notice that some of them appear to give a different result
> on my system.
> For instance, consider the following
>
>
> library(lattice)
> library(latticeExtra)
>
> dotplot(VADeaths, type = "o",
> auto.key = list(lines = TRUE, space = "right"),
> main = "Death Rates in Virginia - 1940",
> xlab = "Rate (per 1000)")
>
>
> This should produce a plot where I have different point shapes
> connected by different line shapes, but I only one point shape
> connected by solid segments.
> Am I misunderstanding something basic?
> Many thanks
>
> Lorenzodeepayan.sarkar@r
>
>
>
> sessionInfo()
> R version 3.4.0 (2017-04-21)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Debian GNU/Linux 8 (jessie)
>
> Matrix products: default
> BLAS: /usr/lib/libblas/libblas.so.3.0
> LAPACK: /usr/lib/lapack/liblapack.so.3.0
>
> locale:
> [1] LC_CTYPE=en_GB.utf8   LC_NUMERIC=C
>  [3] LC_TIME=en_GB.utf8LC_COLLATE=en_GB.utf8
>   [5] LC_MONETARY=en_GB.utf8LC_MESSAGES=en_GB.utf8
>[7] LC_PAPER=en_GB.utf8   LC_NAME=C
> [9] LC_ADDRESS=C  LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
>
> other attached packages:
> [1] latticeExtra_0.6-28 RColorBrewer_1.1-2  lattice_0.20-35
>
> loaded via a namespace (and not attached):
> [1] compiler_3.4.0 tools_3.4.0grid_3.4.0
>
> __
> 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://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Amelia

2017-05-27 Thread Johanna von Bahr
Hi,

I have some trouble with Amelia.

I run the following:


all.data<-read.csv2("jldata2.csv", header = TRUE)
summary(all.data)
corp<-plm.data(all.data, cbind("country", "year"))
data.mi <- Amelia::amelia(corp, idvars=1, ts=2, cs=3,intercs=FALSE,nom=4,5,6, 
7, 8, 13, 14,19:27, 61 , bounds=bounds,log=c(15, 16,17))

And get the result:
Amelia Error Code:  24 
 The number of polynomial terms to include must be between 1 and 3. 

Does anyone have a suggestion for next steps?

Best,
Johanna
__
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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Problem with Example with Lattice

2017-05-27 Thread Lorenzo Isella

Dear All,
I am making my baby steps with the lattice graphic system.
I am going through the great book by Sarkar which provides plenty of
examples.
However, I notice that some of them appear to give a different result
on my system.
For instance, consider the following


library(lattice)
library(latticeExtra)

dotplot(VADeaths, type = "o",
auto.key = list(lines = TRUE, space = "right"),
main = "Death Rates in Virginia - 1940",
xlab = "Rate (per 1000)")


This should produce a plot where I have different point shapes
connected by different line shapes, but I only one point shape
connected by solid segments.
Am I misunderstanding something basic?
Many thanks

Lorenzodeepayan.sarkar@r



sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 8 (jessie)

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.0
LAPACK: /usr/lib/lapack/liblapack.so.3.0

locale:
[1] LC_CTYPE=en_GB.utf8   LC_NUMERIC=C
 [3] LC_TIME=en_GB.utf8LC_COLLATE=en_GB.utf8
  [5] LC_MONETARY=en_GB.utf8LC_MESSAGES=en_GB.utf8
   [7] LC_PAPER=en_GB.utf8   LC_NAME=C
[9] LC_ADDRESS=C  LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] latticeExtra_0.6-28 RColorBrewer_1.1-2  lattice_0.20-35

loaded via a namespace (and not attached):
[1] compiler_3.4.0 tools_3.4.0grid_3.4.0

__
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://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.