Re: [R] TeachingDemos question: my.symbols() alignment problems in complicated layout

2008-07-21 Thread maria
Hi Hadley and Paul,

thank you a lot for the suggestions...

However, i had also emailed Greg Snow  (author of my.symbols() function)
personally... and Greg has emailed me back with a fixed version of the
my.symbols() function -- to be included in the next release -- that works
without a hitch with layout()...

I am not posting it here, as i don't know if i am allowed...

Cheers,
Maria





>> Here are a couple of options:
>>
>> (i)  use the 'gridBase' package and do these arrow annotations using the
>> 'grid' package, which allows you to control coordinate systems in a more
>> rational manner.  There's an example (perhaps slightly more complicated
>> than you need) in:
>> http://cran.r-project.org/doc/Rnews/Rnews_2003-2.pdf
>>
>> (ii) draw your main plot using 'lattice' and the annotations using
>> 'grid' or possibly 'grImport'.  There's a hint of an example of the
>> latter on slide 18 of:
>> http://www.stat.auckland.ac.nz/~paul/Talks/import.pdf
>>
>> (iii) draw the whole thing using 'grid'.  You can start to get
>> acquainted with grid here:
>> http://www.stat.auckland.ac.nz/~paul/RGraphics/chapter5.pdf
>
> (iv) Use ggplot2 - particularly geom_segment
> (http://had.co.nz/ggplot2/geom_segment.html) and stat_spoke
> (http://had.co.nz/ggplot2/stat_spoke.html)
>
> Hadley
>
> --
> http://had.co.nz/
>

__
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, reproducible code.


[R] coefficient p-value in ridge regression

2009-08-15 Thread Maria
Hello. I'have a problem with RIDGE REGRESSION.

I've used lm.ridge function to estimate  coefficients of my model. Why in the 
summary of models not appears t value, Pr(>|t|) and significance stars?

How I can calculate coefficient's p-value in ridge regression?

Thanks!
[[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
and provide commented, minimal, self-contained, reproducible code.


[R] can I do this with R?

2008-05-28 Thread Maria

Hello,
I am just about to install R and was wondering about a few things.

I have only worked in Matlab because I wanted to do a logistic 
regression. However Matlab does not do logistic regression with 
stepwiseforward method. Therefore I thought about testing R. So my 
question is

can I do logistic regression with stepwise forward in R?

Thanks /M

__
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, reproducible code.


[R] barplot with color coding according to value

2008-06-16 Thread maria
Hello,

I want to use R to produce nice meteograms...

For this I would need to color-code my barplot according to the value plotted

say if value x > 30 ... the bar is red ; if x between 20 and 10, the bar
is blue etc...

any ideas how to proceed ?

Thank You a lot,
maria

__
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, reproducible code.


[R] Layout() coordinates and drawing lines / segments

2008-06-26 Thread maria
Hello,

I am trying to wrap my head around the coordinates systems associated with
the layout() function ...with the end goal of simply drawing a decorative
line in the upper margin of my figure, which is composed of three plots.

My output is defined as this:


 postscript("out.ps", horizontal=FALSE,
 +width=7.5,height=11.5,pointsize=10, paper = "special" )

 opar <- par(omi=c(0.1,0.1,0.1,0.1))

 layout_mat = matrix(c(1,2,3),nrow=3,ncol=1,byrow=TRUE)
 my_layout <-
layout(layout_mat,widths=c(1,1,1),heights=c(1,1.5,1.5),respect=FALSE)

-

2 Questions:
How do i find what are the x,y's of the upper margin ?
(I've heard of locator() but i don't think i can use it here as i have an
output file)

And, also, am i allowed to draw lines using segments() or lines() in the
margin regions -- defined by omi, oma -- of my figure, or are those
functions confined to plot regions ?


Thank You a lot,
maria

__
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, reproducible code.


[R] TeachingDemos question: my.symbols() alignment problems in complicated layout

2008-07-11 Thread maria
Hello,

After usefull suggestions by Paul Murrell, i have been trying to use
my.symbols to plot arrows of varying angles on my plot in order to create
a time series of wind direction... however,i have been unable to figure
out how the allignment of symbols works...

below i have included a simplified code that illustrates my problem:
(i am creating a .ps file ... so i've included this in my mock code, in
case it might be part of the problem...)

# TEST CODE #

postscript("test.ps", horizontal=FALSE, width=7.5,
height=11.5,pointsize=10, paper = "special" )

library(TeachingDemos)

opar <- par(omi=c(0,0.1,0.7,0.1),xpd=T,mar=par()$mar+c(0,-1.5,-1,5))

layout_mat = matrix(c(1,2,3,4),nrow=4,ncol=1,byrow=TRUE)

my_layout <-
layout(layout_mat,widths=c(1,1,1,1),heights=c(1.0,0.45,1.0,1.2),respect=FALSE)

plot(1,1)
plot(2,2)
plot(3,3)
plot(1:100,rep(c(9,1.5,2,8),25))
points(40,4,col="red")
points(50,8,col="red")
my.symbols(40,4,ms.polygon,n=3,inches=0.2,add=TRUE)
my.symbols(40,4,ms.arrows,angle=pi/2,inches=0.2,add=TRUE)
my.symbols(50,8,ms.arrows,angle=pi/4,inches=0.2,add=TRUE)
dev.off()

 END of TEST CODE ###

If i look at the output test.ps ... the first symbol is exactly where i
want it to be i.e. at x=40,y=4 ... while the position of the two other
ones is offset by some mysterious(!!) value

then if i comment out the first my.symbols(...) command... the second
symbol is at the right place, while the third is offset ...etc

However if i simply do:

plot(1:100,rep(c(9,1.5,2,8),25))
points(40,4,col="red")
points(50,8,col="red")
my.symbols(40,4,ms.polygon,n=3,inches=0.2,add=TRUE)
my.symbols(40,4,ms.arrows,angle=pi/2,inches=0.2,add=TRUE)
my.symbols(50,8,ms.arrows,angle=pi/4,inches=0.2,add=TRUE


then everything is exactly where i want it ... suggesting there is a
problem with the layout ???

Any help would be really appreciated,
Thank You a lot,
maria

__
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, reproducible code.


[R] pROC

2018-07-23 Thread Maria Enzian



Hello,
I'm using the package pROC in RStudio to create my ROC-curves and I have 
patients in my data - healthy or sick - in the column "Status" and the value 
"SUVmax" to examine it.
I used the following code:
plot.roc(daten$Status,daten$SUVmax,percent=TRUE,ci=TRUE,print.auc=TRUE,main="ROC-Kurve
 für den SUVmax")
The ROC-curve I got is ok, but on the x-axis I got a specificity from 150% to 
-50%, but I want the scale from 100% to 0% (as usual).
xlim=c(100,0) doesn't work.
Can someone help me?
 
Best regards
M.Enzian

__
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] Fitting distributions in uneven parameters

2015-01-06 Thread Maria Lathouri
Hi All, 

First of all, I would like to wish you all a Happy New Year, full of 
creativity, inspiration and prosperity. 

Now, I have a data set with two uneven size parameters  which is the following:
    x1    x2
1  0.98    0.952  0.99    0.98
3  1.11    1.01
4  1.22    1.12
5  1.35    1.25
6  1.45    1.42
7  1.54    1.51
8  1.68    1.67
9  1.75    1.71
10    1.89    1.9011    1.99    NA12    2.11    NA13    2.25    
NA14    2.35    NA15    2.55    NA
I would like to fit and plot distribution in those variables and have them as 
well in the same plot to show the difference; I get an error for the variable, 
x2, which has missing values. 

install fitdistrplus
> fitdist(x1, plnorm)
> plot(x1, plnorm(x1, meanlog=-0.2825, sdlog=0.308), type="l")
> plot(ecdf(x1), cex=0.2, add=TRUE)> fitdist(x2, plnorm)Error in if (any(data 
> <= 0)) stop("values must be positive to fit a lognormal distribution")
I would very much appreciate your help. 

Thank you. 

Kind regardsMaria

   
[[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] taking daily modes from hourly data

2014-09-23 Thread maria cabello
Dear all,
I have a data frame (datos) of hourly wind speed and direction with 4columns 
(1st date, 2nd hour, 3rd wind speed and 4rth wind direction). I have been able 
to do the daily mean of the wind speed, but when I try to get the more frequent 
wind direction of every day, it doesn't work. I have tried to do it with 
aggregate function, but it only works for mean, max, min...

mean_wind<- aggregate(datos[range_of_dates,col_wind_speed], 
list(date=format(as.Date(datos[range_of_dates,col_dates],"%d/%m/%Y"),"%d/%m/%Y")),
 FUN=mean, na.rm=TRUE)  #it works perfectly

mode_wind<- aggregate(datos[range_of_dates,col_wind_direction], 
list(date=format(as.Date(datos[range_of_dates,col_dates],"%d/%m/%Y"),"%d/%m/%Y")),
 FUN=mode)  #it tells me "numeric"

Can anyone help me? My data have not the same length for each day, I mean, for 
example it is possible that for 1st of January I have 20 hours of data, but for 
the 2nd of January I have 24, or the 3rd of January I have 18...so I need to 
aggregate the data to calculate the mean and the mode from the column of my 
date...
Thanks in advance
Mar�a



  
[[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
and provide commented, minimal, self-contained, reproducible code.


[R] Multiple if function

2015-09-15 Thread Maria Lathouri
Dear all, 

I am writing as I would like your help. I have a dataframe with two columns, 
ASB and Flow, where the the first one has values 1, 2 or 3 and the second flow 
data. Something like that:
ASBclass    Flow1  11.51   9.2
2  10.5
3   6.7  ...  ...
I would like to produce a third column named eg. deviation where it would get 
me values based on if ASBclass is 1, multiply Flow by 0.1; if ASBclass is 2 
then multiply Flow by 0.15 and if ASBclass is 3 then multiply by 0.2.

If (ASBclass=1) { deviation<-Flow*0.1}
If (ASBclass=2) { deviation<-Flow*0.15}If (ASBclass=1) { deviation<-Flow*0.2}
I am not sure whether I should add the else function and how can I combine 
these separate functions.

Can anyone help me on that?
Thank you very much. 

Kind regardsMaria

[[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] sorting of files using system

2016-04-08 Thread Maria Ninova
Hello, I came across the following oddity when it comes to file order 
using the system command: different system commands return files in a 
different order:

This is a real filenames example:

> system("ls gw1kb_tables/rpkm_47*", intern=T)
[1] "gw1kb_tables/rpkm_479_Input.tab"
[2] "gw1kb_tables/rpkm_479_IP.tab"

> system("for file in gw1kb_tables/rpkm_4*; do echo $file;done" )
gw1kb_tables/rpkm_479_IP.tab
gw1kb_tables/rpkm_479_Input.tab

As you see, in the first case, the "Input" comes first, while in the 
second, the IP comes first; I was surprised by this result and not sure 
if it's expected?

I am using R version 3.2.2 (2015-08-14) on Ubuntu 15.04

Thank you in advance,

Maria

__
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] Sampling distribution (PDF & CDF) of correlation

2008-07-17 Thread Maria Rizzo
See Chapter 22 in N.L. Johnson, S. Kotz, and N. Balakrishnan,
"Continuous Univariate Distributions", Volume 2, Second Edition, 1995.

  Maria

On Thu, Jul 17, 2008 at 11:29 AM, Mike Lawrence <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm looking for an analytic method to obtain the PDF & CDF of the sampling
> distribution of a given correlation  (rho) at a given sample size (N).
>
> I've attached code describing a monte carlo method of achieving this, and
> while it is relatively fast, an analytic solution would obviously be
> optimal.
>
> get.cors <- function(i, x, y, N){
>end=i*N
>.Internal(cor(x[(end-N+1):end] ,y[(end-N+1):end] ,TRUE ,FALSE ))
> }
> get.r.dist <- function(N, rho, it){
>Sigma=matrix(c(1,rho,rho,1),2,2)
>eS = eigen(Sigma, symmetric = TRUE, EISPACK = TRUE)
>ev = eS$values
>fact = eS$vectors %*% diag(sqrt(pmax(ev, 0)), 2)
>Z = rnorm(2 * N * it)
>dim(Z) = c(2, N * it)
>Z = t(fact %*% Z)
>x = Z[, 1]
>y = Z[, 2]
>r = sapply(1:it ,get.cors,x, y, N)
>return(r)
> }
>
> #Run 1e3 monte carlo iterations, where each obtains the correlation
> # of 10 pairs of observations from a bivariate normal distribution with
> # a true correlation of .5. Returns 1e3 values for the observed correlation
> mc.rs = get.r.dist( N=10 , rho=.5 , it=1e3 )
>
> #plot the PDF & CDF
> par(mfrow=c(1,2))
> hist(mc.rs,prob=T,xlab='Observed correlation')
> probs = seq(0,1,.01)
> plot(quantile(mc.rs,probs=probs),probs,type='l',xlab='Observed
> correlation',ylab='Cumulative probability')
>
> --
> Mike Lawrence
> Graduate Student, Department of Psychology, Dalhousie University
>
> www.memetic.ca
>
> "The road to wisdom? Well, it's plain and simple to express:
> Err and err and err again, but less and less and less."
>- Piet Hein
>
> __
> 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, reproducible code.
>

__
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, reproducible code.


[R] R^2 for poisson and zero inflated regressions

2009-09-14 Thread Maria Sagot
Dear all,
I'm performing poisson regressions using the glm(family=poisson) and
zero-inflated regressions using the zeroinfl from the package pscl. However
any of those give an R^2 and I was wondering if there is a way to get it.

 Thanks

-- 
Maria Sagot
Graduate Student
107 Life Sciences Building
Department of Biological Sciences
Louisiana State University
Phone: 225.578.4284

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] Trendline and R square value

2009-09-28 Thread Lathouri, Maria
Hi

I would like to display the trendline and the R-square value in a xy scatter in 
R. For example if I want to plot f vs g I add the trendline using the commands 
below

>library(quantreg)
>plot(f,g)
>abline(rq(g~f))

however I don't know how to display the R2 in the graph.

Thank you in advance.

Kind regards
Maria

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] plot dates in x-axis

2009-10-13 Thread Lathouri, Maria
Hallo,

I am trying to plot dates in x-axis. The format of my dates are in dd/mm/. 
At first I install zoo package. After R reads my file, I change the default 
format of dates to the format that I have,

>myfile<-read.csv
>DATE<-as.Date(DATE,format="%d/%m/%Y")

up till now everything goes ok; when however I go and plot for example
>plot(DATE, Discharge)

in the x-axis I only get the years, 1998, 2000, 2002...

How can I see in the x-axis the whole format of the dates that I have e.g. 
29/01/1998?



[[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
and provide commented, minimal, self-contained, reproducible code.


[R] superscript in ylab

2009-10-28 Thread Lathouri, Maria
Dear all

I am doing some plots in R.

I want to have as label in y-axis Temperature (oC). I have used 
ylab=expression(paste({Temperature} ^o*C)) but what I get is TemperatureoC.
How can I have a space between Temperature and the units and also the units to 
be in brackets?

Many thanks
Maria



[[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
and provide commented, minimal, self-contained, reproducible code.


[R] .Rhistory in R.app

2009-12-09 Thread Maria Gouskova
Dear R users,

I am having a minor but annoying issue with R.app. It doesn't retain
the history information from the previous sessions. By "history," I
mean a record of commands/functions entered into R rather than the
list of objects--that is properly recorded in the .Rdata file as well
as in a workspace file I save separately.

System details:

R version 2.9.0
R.app GUI 1.28
Mac OS 10.6.2 (MacBook, Intel 2.4 GHz, 4 Gb RAM)

Things I've done:

R>Preferences>Startup>History: Read history file on startup is
checked; R history file directory is specified with a path to my
preferred directory (~/Documents/...). I've tried it with the default
setting, too--it makes no difference.

I've checked the permissions on the .Rhistory file. The default
.Rhistory file created by R has the permissions set at -rw-r--r--.

I've moved the .Rhistory file to a different location (Desktop), so
that R would create a new one. Makes no difference--command history is
still empty at startup.

R has kept track of history on my system in the past--the file I moved
to the desktop has a record of my work from about a year ago. (By the
way, that file's permissions are -rwx-.) Judging by what is in the
old .Rhistory file, the problem started around the time of my upgrade
from 2.7.x to 2.8. I am reluctant to upgrade to R 2.10 in the middle
of a project, because every R upgrade I've done in the past has broken
something, and I've had nothing but grief with my open source apps
after upgrading to Snow Leopard. So if there is some kind of a fix
that doesn't involve upgrading R, I'd love to hear about it.

Maria Gouskova

__
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, reproducible code.


Re: [R] .Rhistory in R.app

2009-12-10 Thread Maria Gouskova
Renaming the .Rhistory file to .Rosxhistory didn't solve the problem
for me--the file is still empty. And I have confirmed that it is a
problem specific to R.app--running R from Terminal works fine, adding
records to the existing .Rhistory file.

Too bad there is no apparent workaround. Thanks, everyone.

Maria

On Wed, Dec 9, 2009 at 2:57 PM, Rob Goedman  wrote:
> Maria,
>
> Try changing the name of .Rhistory in the Startup preferences to something 
> like .Rosxhistory. Press enter to make sure the change is accepted and try 
> again.
> The problem is that R itself overwrites the file .Rhistory if it is told to 
> save the workspace.
>
> Rob
>
>
>
> On Dec 9, 2009, at 10:33 AM, Maria Gouskova wrote:
>
>> Dear R users,
>>
>> I am having a minor but annoying issue with R.app. It doesn't retain
>> the history information from the previous sessions. By "history," I
>> mean a record of commands/functions entered into R rather than the
>> list of objects--that is properly recorded in the .Rdata file as well
>> as in a workspace file I save separately.
>>
>> System details:
>>
>> R version 2.9.0
>> R.app GUI 1.28
>> Mac OS 10.6.2 (MacBook, Intel 2.4 GHz, 4 Gb RAM)
>>
>> Things I've done:
>>
>> R>Preferences>Startup>History: Read history file on startup is
>> checked; R history file directory is specified with a path to my
>> preferred directory (~/Documents/...). I've tried it with the default
>> setting, too--it makes no difference.
>>
>> I've checked the permissions on the .Rhistory file. The default
>> .Rhistory file created by R has the permissions set at -rw-r--r--.
>>
>> I've moved the .Rhistory file to a different location (Desktop), so
>> that R would create a new one. Makes no difference--command history is
>> still empty at startup.
>>
>> R has kept track of history on my system in the past--the file I moved
>> to the desktop has a record of my work from about a year ago. (By the
>> way, that file's permissions are -rwx-.) Judging by what is in the
>> old .Rhistory file, the problem started around the time of my upgrade
>> from 2.7.x to 2.8. I am reluctant to upgrade to R 2.10 in the middle
>> of a project, because every R upgrade I've done in the past has broken
>> something, and I've had nothing but grief with my open source apps
>> after upgrading to Snow Leopard. So if there is some kind of a fix
>> that doesn't involve upgrading R, I'd love to hear about it.
>>
>> Maria Gouskova
>>
>> __
>> 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, reproducible code.
>
>

__
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, reproducible code.


[R] Output of Anova (CAR package) in Sweave

2009-06-16 Thread Maria Wolters

Dear list,

I use Sweave almost exclusively for writing papers, and I have become
quite spoiled by the excellent xtable export facilities. Has anybody
written an xtable method for the Anova function in CAR, or has anybody
used a different set of functions to import Anova results into
a table in an Sweave document? If not, any handy hints on how to
write a good homebrew based on the output of Anova would be much
appreciated - in particular, where can I find Pillai test statistics
and the formula for computing approximate F that is used in the
CAR package? I have Fox' "R and S-Plus Companion to Regression".

I'm aware that this is a very basic question -
thank you for your patience!

Maria Wolters



--
Dr Maria Wolters
   CSTR / HCRC, School of Informatics
   MATCH Research Fellow
   EdSST Project Manager
mwolters AT staffmail.ed.ac.uk

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

__
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, reproducible code.


Re: [R] Output of Anova (CAR package) in Sweave

2009-06-16 Thread Maria Wolters

Many thanks to John Fox, who replied on-list,
and to David Hajage, who replied to me
off list. David suggested this quick hack of the
print.anova.mlm function, which I am sharing with his
permission

# From print.Anova.mlm
xtable.Anova.mlm <- function (x, ...) {
test <- x$test
repeated <- x$repeated
ntests <- length(x$terms)
tests <- matrix(NA, ntests, 4)
if (!repeated)
SSPE.qr <- qr(x$SSPE)
for (term in 1:ntests) {
eigs <- Re(eigen(qr.coef(if (repeated) qr(x$SSPE[[term]]) else
SSPE.qr,
x$SSP[[term]]), symmetric = FALSE)$values)
tests[term, 1:4] <- switch(test, Pillai = stats:::Pillai(eigs,
x$df[term], x$error.df), Wilks = stats:::Wilks(eigs,
x$df[term], x$error.df), `Hotelling-Lawley` = stats:::HL(eigs,
x$df[term], x$error.df), Roy = stats:::Roy(eigs,
x$df[term], x$error.df))
}
ok <- tests[, 2] >= 0 & tests[, 3] > 0 & tests[, 4] > 0
ok <- !is.na(ok) & ok
tests <- cbind(x$df, tests, pf(tests[ok, 2], tests[ok, 3],
tests[ok, 4], lower.tail = FALSE))
rownames(tests) <- x$terms
colnames(tests) <- c("Df", "test stat", "approx F", "num Df",
"den Df", "Pr(>F)")
tests <- structure(as.data.frame(tests), heading = paste("\nType ",
x$type, if (repeated)
" Repeated Measures", " MANOVA Tests: ", test, " test
statistic",
sep = ""), class = c("anova", "data.frame"))
#print(tests)
#    invisible(x)
  xtable(test)
}

John provided extremely useful additional information; the link to  
Peter Dalgaard's article is also much appreciated.


Maria, a "happy customer" ;)

--
Dr Maria Wolters
   CSTR / HCRC, School of Informatics
   MATCH Research Fellow
   EdSST Project Manager
mwolters AT staffmail.ed.ac.uk

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

__
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, reproducible code.


[R] "Explore" SPSS function in R

2012-10-04 Thread MARIA RODRIGUEZ
Hi everyone,

Does anybody knows if there is an equivalent R function  that gives the same
outcome as in "Explore" function in SPSS ?
(Analize->Descriptive Statistics->Explore)

It does a categorical vs quantitative variables analysis. ( But not linear
regression)

I need to compare intragroup (categorical variable with 4 values) means and
confidence intervals of a quantitative variable.
Just like "Explore" function does.

Thanks a lot




--
View this message in context: 
http://r.789695.n4.nabble.com/Explore-SPSS-function-in-R-tp4645013.html
Sent from the R help mailing list archive at Nabble.com.

__
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, reproducible code.


[R] [Vars] package: impulse response function

2012-10-21 Thread Maria Grigoryeva
Hello,

I'm doing a research on the impulse responses in VAR models and I'm having
troubles in interpretation of R results.
My question is what is the shock of impulse variable that is produced to
obtain the response? Is it one-standard-deviation positive shock? If it is
so how can I obtain  the responses on other types of shocks, say, 10%
negative shock?

Thanks a lot,

Marion

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] "Vars" package: impulse response function

2012-10-22 Thread Maria Grigoryeva
Hello,

I'm using VAR models in R in order to obtain impulse responses of stock
market shock on US economy.
I have series of quarterly changes in real gdp, S&P 500 and quarterly level
of unemployment for 1985 - 2012 period.
My series are stationary. So I did all the steps below. However I don't
understand what do irf function results mean. These are the cumulative
orthogonal responses to sp variable shock but what is the value of this
shock? If for example I have to assess the response on 10% increase of sp
variable what should I do with these results?

Thanks a lot,
Marion

> #make a data frame
> vardat3<-data.frame(gdp,unemp,sp)
> #select the number of lags: const
> infocrit<-VARselect(vardat3,lag.max=20,type="const")
> infocrit
$selection
AIC(n) HQ(n) SC(n) FPE(n)
20 2 1 2

$criteria
1 2 3 4
AIC(n) -1.862833e+01 -1.880996e+01 -1.868877e+01 -1.863180e+01
HQ(n) -1.849392e+01 -1.857475e+01 -1.835275e+01 -1.819497e+01
SC(n) -1.829502e+01 -1.822667e+01 -1.785550e+01 -1.754855e+01
FPE(n) 8.126326e-09 6.781829e-09 7.669554e-09 8.146337e-09
5 6 7 8
AIC(n) -1.853795e+01 -1.846199e+01 -1.842426e+01 -1.830997e+01
HQ(n) -1.800031e+01 -1.782355e+01 -1.768500e+01 -1.746991e+01
SC(n) -1.720471e+01 -1.687878e+01 -1.659106e+01 -1.622679e+01
FPE(n) 8.995957e-09 9.782674e-09 1.027092e-08 1.168454e-08
9 10 11 12
AIC(n) -1.839671e+01 -1.835691e+01 -1.841065e+01 -1.844365e+01
HQ(n) -1.745585e+01 -1.731524e+01 -1.726817e+01 -1.720037e+01
SC(n) -1.606356e+01 -1.577377e+01 -1.557753e+01 -1.536055e+01
FPE(n) 1.091936e-08 1.164000e-08 1.136733e-08 1.141161e-08
13 14 15 16
AIC(n) -1.844870e+01 -1.841054e+01 -1.842814e+01 -1.845378e+01
HQ(n) -1.710461e+01 -1.696564e+01 -1.688243e+01 -1.680727e+01
SC(n) -1.511562e+01 -1.482748e+01 -1.459510e+01 -1.437076e+01
FPE(n) 1.187493e-08 1.302227e-08 1.365157e-08 1.437544e-08
17 18 19 20
AIC(n) -1.850238e+01 -1.857360e+01 -1.890488e+01 -1.906878e+01
HQ(n) -1.675506e+01 -1.672547e+01 -1.695594e+01 -1.701904e+01
SC(n) -1.416937e+01 -1.399062e+01 -1.407191e+01 -1.398583e+01
FPE(n) 1.501343e-08 1.559817e-08 1.275793e-08 1.265147e-08

> #Estimate VAR
> varestim3<-VAR(vardat3,p=1,type="const",season=NULL,exogen=NULL)
> summary(varestim3)

VAR Estimation Results:
=
Endogenous variables: gdp, unemp, sp
Deterministic variables: const
Sample size: 109
Log Likelihood: 564.356
Roots of the characteristic polynomial:
0.9574 0.5034 0.1505
Call:
VAR(y = vardat3, p = 1, type = "const", exogen = NULL)

Estimation results for equation gdp:

gdp = gdp.l1 + unemp.l1 + sp.l1 + const

Estimate Std. Error t value Pr(>|t|)
gdp.l1 4.006e-01 9.177e-02 4.365 2.98e-05 ***
unemp.l1 5.559e-05 3.629e-04 0.153 0.8785
sp.l1 1.131e-02 6.656e-03 1.699 0.0923 .
const 3.254e-03 2.413e-03 1.349 0.1803
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.005577 on 105 degrees of freedom
Multiple R-Squared: 0.2199, Adjusted R-squared: 0.1976
F-statistic: 9.865 on 3 and 105 DF, p-value: 8.683e-06

Estimation results for equation unemp:
==
unemp = gdp.l1 + unemp.l1 + sp.l1 + const

Estimate Std. Error t value Pr(>|t|)
gdp.l1 -29.44722 3.55186 -8.291 4.02e-13 ***
unemp.l1 0.96915 0.01405 69.003 < 2e-16 ***
sp.l1 -0.40886 0.25761 -1.587 0.115
const 0.39656 0.09339 4.246 4.71e-05 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.2159 on 105 degrees of freedom
Multiple R-Squared: 0.9801, Adjusted R-squared: 0.9796
F-statistic: 1728 on 3 and 105 DF, p-value: < 2.2e-16

Estimation results for equation sp:
===
sp = gdp.l1 + unemp.l1 + sp.l1 + const

Estimate Std. Error t value Pr(>|t|)
gdp.l1 4.376417 1.352306 3.236 0.00162 **
unemp.l1 0.007670 0.005347 1.434 0.15444
sp.l1 -0.059427 0.098079 -0.606 0.54588
const -0.050007 0.035556 -1.406 0.16256
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.08219 on 105 degrees of freedom
Multiple R-Squared: 0.09843, Adjusted R-squared: 0.07267
F-statistic: 3.821 on 3 and 105 DF, p-value: 0.01211

Covariance matrix of residuals:
gdp unemp sp
gdp 3.111e-05 -0.0005809 9.583e-05
unemp -5.809e-04 0.0466008 -2.886e-03
sp 9.583e-05 -0.0028862 6.755e-03

Correlation matrix of residuals:
gdp unemp sp
gdp 1. -0.4825 0.2091
unemp -0.4825 1. -0.1627
sp 0.2091 -0.1627 1.

> #roots inferior to 1
> roots<-roots(varestim3)
> roots
[1] 0.9574116 0.5033992 0.1504822
> irf_unemp3<-irf(varestim3, impulse="sp", response="unemp",
ortho="TRUE",n.ahead=12, cumulative="TRUE",boot=FALSE)
> irf_unemp3

Impulse response coefficients
$sp
unemp
[1,] 0.
[2,] -0.03277601
[3,] -0.08928549
[4,] -0.15473977
[5,] -0.22331618
[6,] -0.29191758
[7,] -0.35908457
[8,] -0.42413901
[9,] -0.48679952
[10,] -0.54698101
[11,] -0.60469490
[12,] -0.65999890
[13,] -0.71297176

This message and any attachments (the "message") is
intended solely for the intended addressees and 

Re: [R] find the Best-ticker

2012-10-29 Thread sheen maria
Thank you


On Mon, Oct 29, 2012 at 1:44 PM, R. Michael Weylandt <
michael.weyla...@gmail.com>  wrote:

>
>
> On Oct 29, 2012, at 6:11 AM, sheenmaria  wrote:
>
> > i need to find the best ticker from the group of some tickers.?
> > i also need to know on what basis we calculate the best ticker?
> >  i have some idea about the if the risk rate low, or the market price
> > high we can say the ticker is best.
> >   but i dont know is it true.
> >
> >
> I've always been a big fan of the agribusiness ETF MOO!
>
> But seriously, I've answered this one from you before. The question is
> ill- posed without a metric but you may want to look at
> PerformanceAnalytics available via CRAN.
>
> Michael
>
>
> > Anyone can help me .
> >
> > Thank you
> >
> >
> >
> > --
> > View this message in context:
> http://r.789695.n4.nabble.com/find-the-Best-ticker-tp4647734.html
> > Sent from the R help mailing list archive at Nabble.com.
> >
> > __
> > 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, reproducible code.
>

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] grouping explanatory variables into "sets" for GLMM

2014-04-03 Thread Maria Kernecker
Dear all, 

I am trying to run a GLMM following the procedure described by Rhodes et al. 
(Ch. 21) in the Zuur book Mixed effects models and extensions in R . Like in 
his example, I have four "sets" of explanatory variables: 
1. Land use - 1 variable, factor (forest or agriculture)
2. Location - 1 variable, factor (riparian or upland)
3. Agricultural management - 3 variables that are binary (0 or 1 for till, 
manure, annual crop)
4. Vegetation patterns - 4 variables that are continuous (# of plant species in 
4 different functional guilds)

How do I create these "sets"?  I would like to build my model with these "sets" 
only instead of listing every variable. 

Also: is there a way of running all possible models with the different 
combinations of these sets and/or variables, sort of like running ordistep for 
ordinations?

Thanks a bunch in advance for your help!
Maria  

__
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, reproducible code.


[R] CCA plot

2012-11-27 Thread Maria Kernecker
Hi, I have a couple questions about fitting environmental (land use
factors, plant species presence-absence, and soil variables) constraints to
my CCA biplot. 1. After successfully plotting species and site scores in my
CCA, I have been trying to insert the biplot arrows of the environmental
constraints in my data set using the text() function. When I do that, the
plot changes completely. Is there some code or a sample script you could
let me know about? 2. I would like to include only the environment
constraints that are significant at conf=0.95, but am not sure that I can
do that in a CCA biplot. I was hoping that this way I could make my plot
less crowded.
Thanks!

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] dealing with different kinds of environmental data in one matrix

2012-11-28 Thread Maria Kernecker
Hi,

I have done a CCA with an environmental data matrix including both relative
abundance of plant species, soil properties (continuous, with different
units of concentrations), and factors that should explain my species
matrix.

Only after running the analysis have I realized that I should have done
some kind of transformation to standardize the relative abundance of plant
species and soil properties. Which transformation can I use for this case?
Is it possible to use these two different types of data in one matrix?

Thanks.

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] Uncertainty analysis

2010-09-09 Thread Lathouri, Maria
Dear all

I would like to run in R an uncertainty/sensitivity analysis. I know that these 
two are performed together. I have a geochemical model where I have the inputs, 
the water variables (e.g. pH, temperature, oxygen ect) and as well an output of 
different variables. What I would like to do is to estimate the uncertainty 
that the output variables have considering the uncertainty of the input 
variables as well how the variations of my inputs contribute most to the 
variations of my output (probably though the sensitivity analysis). I was 
thinking perhaps with Monte Carlo analysis.

Is there a way to do that?

Thanks a lot.

Maria



[[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
and provide commented, minimal, self-contained, reproducible code.


[R] specify axis range

2010-08-31 Thread Lathouri, Maria
Dear all,

I want to make a plot where I can specify the range of y axis. I am using the 
interaction.plot command and because the values of y axis are from 2 to 500, I 
am using a logarithmic scale.

>interaction.plot(speclong$Date,speclong$time2,speclong$outcome,xaxt="n",type="l",pch=20,xlab="",
> log="y", ylab="Concentration (ug/L)",trace.label="",col=rainbow(7))



The plot itself gives me a y scale displaying ticks at 2, 5, 10, 20, 100, 200, 
500. I would like to get a y scale where it would display ticks at every 4 
marks, at 2, 20, 100 and 500.



I tried ylim=c(2,20,100,500) but nothing happened. Actually I got an error.



Could you help me?



Thank you.



Maria


[[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
and provide commented, minimal, self-contained, reproducible code.


[R] change the type of lines and colours in interaction.plot

2010-09-03 Thread Lathouri, Maria
Dear all,

I want to plot 8 chemical variables in the same plot. I have used the 
interaction.plot command:

> interaction.plot(speclong$Date,speclong$time2,speclong$outcome,xaxt="n",type="l",pch=20,xlab="",
>  log="y", ylab="Concentration (ug/L)",trace.label="",col=rainbow(8))
However, what it gives me is dotted lines and the colours are very fade. I was 
wondering if I can change the lines to be solid and as well to specify for each 
line the colour that I want.

Thanks a lot.

Maria

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] Specifying grouping factor for augPred in nlme

2011-06-09 Thread Maria Stager
Dear list,

I have a seemingly simple problem with plotting predictions from nlme for
which I have not been able to find an answer in the archives nor do I see
any mention of this in Pinheiro & Bates 2000. I am using the following model
of chick growth for seven different species, with season, nest and
individual chick as random effects (all of which are categorical).

chickg<-groupedData(nmass~age|fspecies, chick, order.groups=F)

logistic<-deriv(~A/(1+(((A-I)/I)*exp(-age*K))), c("A","I","K"),
function(age,A,I,K) {})

ab<-nlme(nmass~logistic(age,A,I,K), chickg, fixed=A+I+K~fspecies,
random=A+K~1|fseason/fnest/fchick, start=fab6)

I would like a separate plot for each species (fspecies). As of yet, I have
only been able to plot by fseason using

plot(augPred(ab, level=0))

or by fchick when no level is set. getGroups(ab) returns 2295 levels, one
for each individual. How does one specify that the fixed effect should be
used as the grouping factor?

Thank you,
M

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] please help-DTK package

2011-02-08 Thread Lathouri, Maria
Dear all

I am trying to do a multiple pairwise comparison test with Tukey-Kramer test as 
I have unequal sample sizes and variance. I have downloaded the DTK package 
from CRAN website in my computer for Windows, however I have difficulties in 
installing it in R.

I have unzipped the compressed file in my computer and then I open R, I try to 
install the package through File - Source R code - DTK but there is always an 
error.

Could you please help me? I can't understand what I am doing wrong.

Thank you.

Maria

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] add error bars in a plot

2011-02-08 Thread Lathouri, Maria
Dear all

I have a dataset of how metal concentrations change through time. I have made a 
plot of date versus metal concentration. However I want to add error bars in 
the plot.

Could you help me?

Thanks
Maria

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] barplot with errorbars

2011-02-17 Thread Lathouri, Maria
Dear all

I have six variables of the average metal concentrations

Var1 4.77
Var2 23.5
Var3 5.2
Var4 12.3
Var5 42.1
Var6 121.2

I want to plot them as a barplot with error bars. Could you help me?

Cheers
Maria

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] please help with interaction.plot

2011-03-02 Thread Lathouri, Maria
Dear all

I have the following code to produce a graph of 5 different variables in the 
same graph; however when I follow it in the end it produces the plot of the 5 
variables and a legend in right but the problem is that the legend is too close 
to the margin of the plot and when I try to write the text for each line it 
does not fit. How can I change the location of the legend to be placed a little 
bit to the left?

example<-read.csv(file="example.csv")
example$date<-as.Date(example$Date,format="%d/%m/%Y",order="dmy")
head(example)
str(example)
names<-names(example)[2:5]
examplelong <- reshape(example, idvar = "id", varying = list(names), 
v.names="outcome",direction = "long")
examplelong$time2<-factor(examplelong$time,labels=rep("   ",4))
d3<-c((examplelong$date[1]),(examplelong$date[103]))
d4<-as.Date((d3[1])+150*(0:20))
interaction.plot(examplelong$date, 
examplelong$time2,examplelong$outcome,xaxt="n",type="l",pch=20,xlab="", 
log="y", ylab=expression(paste(Concentration~(~mu~g/L))), 
trace.label="",col=rainbow(4))

Thank you
Maria

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] how to change the margins of a plot area

2011-03-13 Thread Lathouri, Maria
Dear all,

I am ploting two boxplot of two chemical variables using the format
boxplot(Alkalinity, logAlkalinity, log="y", col=c("lightblue"), lwd=0.6, 
boxwex=0.3)

However when I plot like this, the distance between the two boxplots is very 
big and as well the distance of each boxplot from the plot area, left and 
right. How can I minimise that distance between the boxplots and as well the 
distance of each boxplot from the left and right margin of the plot area?

Another question is that when I write in the above ylab="Concentration", I get 
in the y axis as well in each tick and a number. How can I not have this but 
only the text?

Thank you.

Kind regards
Maria

[[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to change the margins of a plot area

2011-03-13 Thread Lathouri, Maria
Dear all

I have attached a file in a csv format, with two variables; the code that I am 
using to plot the boxplots is 
>boxplot(ALKY, CL, ylab="Concentration", lwd=0.7, boxwex=0.4)

I hope this will help.

Thanks
Maria


From: John Kane [jrkrid...@yahoo.ca]
Sent: 13 March 2011 13:19
To: r-help@r-project.org; Lathouri, Maria
Subject: Re: [R] how to change the margins of a plot area

Hi Maria,
I think we need some sample data and code to really be ablo to help.

in the meantime have have a look at ?par for general plotting info.

--- On Sun, 3/13/11, Lathouri, Maria  wrote:

> From: Lathouri, Maria 
> Subject: [R] how to change the margins of a plot area
> To: "r-help@r-project.org" 
> Received: Sunday, March 13, 2011, 8:15 AM
> Dear all,
>
> I am ploting two boxplot of two chemical variables using
> the format
> boxplot(Alkalinity, logAlkalinity, log="y",
> col=c("lightblue"), lwd=0.6, boxwex=0.3)
>
> However when I plot like this, the distance between the two
> boxplots is very big and as well the distance of each
> boxplot from the plot area, left and right. How can I
> minimise that distance between the boxplots and as well the
> distance of each boxplot from the left and right margin of
> the plot area?
>
> Another question is that when I write in the above
> ylab="Concentration", I get in the y axis as well in each
> tick and a number. How can I not have this but only the
> text?
>
> Thank you.
>
> Kind regards
> Maria
>
> [[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
> and provide commented, minimal, self-contained,
> reproducible code.
>__
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, reproducible code.


[R] FW: how to change the margins of a plot area

2011-03-13 Thread Lathouri, Maria
Dear all

I am sorry about that; I thought that since in R csv formats are acceptable, it 
will be here as well. I have attached it in a text format.

I hope now it is better.

Thank you
Maria


From: David Winsemius [dwinsem...@comcast.net]
Sent: 13 March 2011 18:24
To: Lathouri, Maria
Subject: Re: [R] how to change the margins of a plot area

Please read the Posting Guide and note that ".csv" files are NOT
mentioned as one of the acceptable formats for attachments to postings!


On Mar 13, 2011, at 1:00 PM, Lathouri, Maria wrote:

> Dear all
>
> I have attached a file in a csv format, with two variables; the code
> that I am using to plot the boxplots is
>> boxplot(ALKY, CL, ylab="Concentration", lwd=0.7, boxwex=0.4)
>
> I hope this will help.
>
> Thanks
> Maria
>
> 
> From: John Kane [jrkrid...@yahoo.ca]
> Sent: 13 March 2011 13:19
> To: r-help@r-project.org; Lathouri, Maria
> Subject: Re: [R] how to change the margins of a plot area
>
> Hi Maria,
> I think we need some sample data and code to really be ablo to help.
>
> in the meantime have have a look at ?par for general plotting info.
>
> --- On Sun, 3/13/11, Lathouri, Maria 
> wrote:
>
>> From: Lathouri, Maria 
>> Subject: [R] how to change the margins of a plot area
>> To: "r-help@r-project.org" 
>> Received: Sunday, March 13, 2011, 8:15 AM
>> Dear all,
>>
>> I am ploting two boxplot of two chemical variables using
>> the format
>> boxplot(Alkalinity, logAlkalinity, log="y",
>> col=c("lightblue"), lwd=0.6, boxwex=0.3)
>>
>> However when I plot like this, the distance between the two
>> boxplots is very big and as well the distance of each
>> boxplot from the plot area, left and right. How can I
>> minimise that distance between the boxplots and as well the
>> distance of each boxplot from the left and right margin of
>> the plot area?
>>
>> Another question is that when I write in the above
>> ylab="Concentration", I get in the y axis as well in each
>> tick and a number. How can I not have this but only the
>> text?
>>
>> Thank you.
>>
>> Kind regards
>> Maria
>>
>>[[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
>> and provide commented, minimal, self-contained,
>> reproducible code.
> __
> 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, reproducible code.

David Winsemius, MD
West Hartford, CTALKYCL
24  17
42  16.8
20  15.2
33  15.8
34  14.7
38  14.8
32  13.2
27  13.3
37  15.7
31  12.7
31  14
35  14.8
30  14.6
31  14.7
34  15.6
39  16
44  15.2
40  14.3
51  17.2
41  16.3
30  12
48  15.1
40  14
46  15.8
33  13.9
44  15.2
33  14.1
33.42520849 14.6906392
31  14.6
31  10.6
49.65524516 15.8163576
49  15
47  14.3
33  13
39  12.5
38  12.8
30  12
30  12.2
29.82656017 14.29424761
34  14.2
34  12.8
56  16
60  17.4
61  18.4
59  15.7
44  15.3
41  16.2
33  13.8
38  13
41  13.5
37  17.1
21  12.8
39  16.1
36.412.5
50.717.1
37.312.1
41.711.9
62.117.5
43.413.8
42  13.5
40  14.1
40.16876216 15.9
36.48094861 16.4
41.4029284  15.5
55.16932486 17
56.74926517 17.2
40.75086976 14.9
57.92527479 15.5
61.0741 16.4
47.58835403 15.8
26.78666719 19.8
29.11069914 18.5
43.89296089 15.7
29.80014395 15.3
45.43326189 17.9
21.52111069 14.8
34.28668871 16.3
51.33203813 15.4
61.16524423 19.1
33.08808335 16
28.45357602 13.1
46.95762322 15
41.2184536  14.6
41.67606216 14
34.53359965 17.6
34.88690373 17.4
34.61562996 15.5
44.29030259 17
39.68692169 16.3
39.43498713 19.5
37.04679913 16.6
58.97385637 16.1
44.08944815 14.9
42.07100781 13.8
40.29932265 15.4
43.10896392 16.6
34.27550906 13.6
28.53052378 11.9
46.85048052 15.9
__
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, reproducible code.


[R] fitting a distribution to a ecdf plot

2011-03-15 Thread Lathouri, Maria
Dear all,

I need to plot an cumulative distribution plot of a variable and then to fit a 
distribution to that, probably a weibull or lognormal.

I have plotted the ecdf as
> plot(ecdf(x))

but I haven't managed to fit the distribution. I have as well attached the data.

I would appreciate if you could help me on that.

Thank you.

Kind regards
Maria
NOECCu
67.88904443
150.1397457
186.4661306
125.4586537
164.6450167
82.26572728
46.12957405
139.3670831
77.3140337
73.71616087
89.24381267
55.49698407
161.4744795
110.9611291
103.3427988
120.978441
121.3764833
100.1028412
145.5605989
142.3290787
145.3679277
93.62492361
55.48686698
128.11105
69.65897422
77.74185999
115.8001364
50.45232492
90.35071838
132.9893917
77.72242849
64.28160263
54.01295646
83.71891269
134.0958513
64.60377903
48.18032813
130.486115
56.73379201
52.23087454
50.33847793
54.88254634
109.1721021
48.20831769
87.10977697
47.02111749
63.29204939
48.15737916
59.51869418
63.70426227
83.97669506
93.56957986
94.13697821
49.81656675
41.49804514
51.05645798
61.76354398
60.6012629
54.42093914
93.51486665
60.54396105
48.85428234
166.7654584
146.810965
80.95967487
167.2626315
59.47330368
72.86066214
116.4378185
55.64725599
121.2565064
71.47595431
133.7136451
73.82132992
137.8096239
49.83650594
81.08199187
89.36373311
47.72963718
49.02577131
54.0245052
47.18943578
106.7524366
92.86330941
107.7602873
80.46842086
203.1770731
63.47382772
106.0130281
90.67128789
85.91406122
85.65280069
129.637575
81.89671307
115.5356497
65.53656745
129.3789983
83.07309212
95.3862417
47.64942729
44.58198126
65.91324525
85.98441643
173.7522613
68.43518477
62.19982961
60.48931609
79.84400257
196.0585861
79.15253575
198.4031949
188.8371774
67.2503906
76.7620257
154.1797827
84.26522759
70.97081638
56.37466386
129.0594303
114.5855536
73.67967762
536.9946813
78.95253975
71.19112816
51.24938953
67.10699555
93.07971733
52.55033118
48.98038035
71.99776449
87.15210545
120.8311727
63.00287326
67.90228061
87.24346937
170.9653141
174.1646464
51.72208312
55.25671981
67.79918864
52.23148551
68.94684451
58.64711247
__
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, reproducible code.


Re: [R] fitting a distribution to a ecdf plot

2011-03-15 Thread Lathouri, Maria
Actually I have already done a search on that but it was not much of a help. 
That is why I posted it in the r-help in case it was much more helpful. 

Thank you.

Kind regards
Maria


From: David Winsemius [dwinsem...@comcast.net]
Sent: 15 March 2011 16:19
To: Lathouri, Maria
Cc: r-help@r-project.org
Subject: Re: [R] fitting a distribution to a ecdf plot

On Mar 15, 2011, at 12:00 PM, Lathouri, Maria wrote:

> Dear all,
>
> I need to plot an cumulative distribution plot of a variable and
> then to fit a distribution to that, probably a weibull or lognormal.
>
> I have plotted the ecdf as
>> plot(ecdf(x))
>
> but I haven't managed to fit the distribution. I have as well
> attached the data.

Try a search on one of the R search sites with:

"Fitting distributions with R"  # use the quotes


>
> I would appreciate if you could help me on that.
>
> Thank you.
>
> Kind regards
> Maria
> __
> 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, reproducible code.

David Winsemius, MD
West Hartford, CT
__
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, reproducible code.


Re: [R] fitting a distribution to a ecdf plot

2011-03-15 Thread Lathouri, Maria
Hallo
yes I tried it as well and it works;

Thank you a lot

Maria


From: Dennis Murphy [djmu...@gmail.com]
Sent: 15 March 2011 21:36
To: Lathouri, Maria
Cc: r-help@r-project.org
Subject: Re: [R] fitting a distribution to a ecdf plot

Hi:

The fitdistrplus package from CRAN may be useful. I tried it on your data and 
the lognormal seemed to fit well, apart from the outlier. I just followed the 
vignette that accompanies the package.

library(fitdistplus)

plotdist(NOEccu) # ecdf
descdist(NOEccu, boot = 1000)  # Cullen-Frey graph based on 1000 bootstrap 
samples

# The Cullen-Frey graph suggests that the distribution is somewhere between a 
Gamma and lognormal

# Weibull
N1w <- fitdist(NOEccu, 'weibull')
# Warning messages:
# 1: In dweibull(x, shape, scale, log) : NaNs produced
# 2: In dweibull(x, shape, scale, log) : NaNs produced
plot(N1w)
summary(N1w)

# Gamma
N1g <- fitdist(NOEccu, 'gamma')
# Warning messages:
# 1: In dgamma(x, shape, scale, log) : NaNs produced
# 2: In dgamma(x, shape, scale, log) : NaNs produced
# 3: In dgamma(x, shape, scale, log) : NaNs produced
# 4: In dgamma(x, shape, scale, log) : NaNs produced
plot(N1g)
summary(N1g)

# Lognormal
N1l <- fitdist(NOEccu, 'lnorm')
plot(N1l)
summary(N1l)

Try it out and see if it suits your needs.

HTH,
Dennis

On Tue, Mar 15, 2011 at 9:00 AM, Lathouri, Maria 
mailto:m.lathour...@imperial.ac.uk>> wrote:
Dear all,

I need to plot an cumulative distribution plot of a variable and then to fit a 
distribution to that, probably a weibull or lognormal.

I have plotted the ecdf as
> plot(ecdf(x))

but I haven't managed to fit the distribution. I have as well attached the data.

I would appreciate if you could help me on that.

Thank you.

Kind regards
Maria

__
R-help@r-project.org<mailto: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, reproducible code.



[[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] cluster with mahalanobis distance

2012-05-30 Thread Maria Froes
How can I perform cluster analysis using the mahalanobis distance instead of

the euclidean distance?

 

Thank you 

Maria Froes


[[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] INSTRUMENTAL VARIABLES WITH BINARY OUTCOMES

2012-09-06 Thread MARIA RODRIGUEZ
This is the named article: 
http://ije.oxfordjournals.org/content/37/5/1161.long

maybe it can help you to help me...  :-(



--
View this message in context: 
http://r.789695.n4.nabble.com/INSTRUMENTAL-VARIABLES-WITH-BINARY-OUTCOMES-tp4642361p4642363.html
Sent from the R help mailing list archive at Nabble.com.

__
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, reproducible code.


[R] interaction plot and x axis

2012-01-04 Thread Lathouri, Maria
Dear all



 I am trying to make an interaction plot among 6 variables; e.g. PH to be in 
the x axis and the rest 5 variables in the y axis. The code that I am using is 
the below:



The name of my file is e.g. spec so



> spec<-read.csv("spec.csv")

>head (spec)

>str(spec)

>names<-names(spec)[2:6]
>speclong <- reshape(spec, idvar = "id", varying = list(names), 
>v.names="outcome",direction = "long")

>speclong$time2<-factor(speclong$time,labels=rep("   ",5))

>interaction.plot(speclong$PH,speclong$time2,speclong$outcome, xaxt="n", 
>type="l", log="y", trace.label="",col=rainbow(8))



what I want is to change the labels of the x axis. If for example I don't use 
xaxt="n", by default it shows some values of PH e.g. 4.93, 5.97, 6.23, 6.47, 
6.59, 6.77, 6.89, 7.35 but it don't show the ticks in each value. However I 
would like to define the x values e.g. 5.0, 5.5, 6.0, 6.5, 7.0. I used the xlim 
but it says error as well

>axis(1, at=c(5.0, 5.5, 6.0, 6.5, 7.0)) but still there is a problem.



Does anyone know how I can define that?



Thank you in advance.



Kind regards

Maria

[[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] multinormality

2008-06-08 Thread Maria Rizzo
For a test of multivariate normality, there is mvnorm.etest in the
energy package.

 Maria Rizzo

On Sun, Jun 8, 2008 at 6:01 AM, hanen <[EMAIL PROTECTED]> wrote:
>
> is there any function under R that allows me to test the normality of my 92
> sumples?
> --
> View this message in context: 
> http://www.nabble.com/multinormality-tp17717230p17717230.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> 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, reproducible code.
>

__
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, reproducible code.


[R] transform a table into a matrix

2008-06-23 Thread Maria Gavilanez
Hi.

is there a way to transform a table that has numeric and categorical variables 
into a matrix?

thanks


Maria Mercedes Gavilanez
Department of Biological Sciences
107 Life Sciences Building
Louisiana State University
Baton Rouge, LA 70803
(225)578-4284

__
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, reproducible code.


[R] [R-pkgs] energy 1.1-0 with dcov

2008-04-09 Thread Maria Rizzo
Dear R-users,

An updated version of the energy package, energy 1.1-0, is now available on 
CRAN.

This version has merged the dcov package (previously available from my 
personal web page) into energy.

New functions include:

dcov (distance covariance)
dcor (distance correlation)
DCOR (four statistics)
dcov.test (distance covariance test of multivariate independence)
indep.test (choice of nonparametric energy tests of multivariate independence)

These functions implement the new methods introduced in our recent article:

G. J. Szekely, M. L. Rizzo and N. K. Bakirov (2007) Measuring and Testing 
Independence by Correlation of Distances, Annals of Statistics, Vol. 35 No. 
6, pp. 2769-2794.

Distance correlation R is a scalar statistic for measuring and testing 
independence of random vectors. It satisfies 0<=R<=1 and R=0 only if 
independence holds. Distance covariance V determines a statistically 
consistent test of independence.

The distance covariance test is theoretically related to, but different 
from the original test based on coefficient I_n implemented in indep.etest. 
The new dcov.test is faster by a factor O(n) than indep.etest.

With the introduction of a second and faster test, we provide a new 
function indep.test with a choice of methods to obtain either test. The 
original indep.etest is now deprecated.

Reprints of the article are available upon request.

Comments and suggestions are always welcome.

   Maria Rizzo and Gabor Szekely

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

__
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, reproducible code.


[R] why incomplete lmer output?

2008-04-15 Thread Maria Meyen
Dear all,

I have problems with the lmer output (see
below)(2.6.2, WindowsXP), it is incomplete (no DFs, no
p-values)and also generating an anova-table doesn´t
work out. What is the fault? Does anybody know?

This example is about plant height within different
treatments (each with 5 replicates) measured several
times. I´m interested in the treatment effect.

> pap<-groupedData(heig~meas|box,outer=~treat,pap)
> mod<-lmer(heig~treat+(meas|box),pap)
> summary(mod)
Linear mixed-effects model fit by REML 
Formula: heig ~ treat + (meas | box) 
   Data: pap 
   AIC   BIC logLik MLdeviance REMLdeviance
 134.1 156.6 -58.05  97.14116.1
Random effects:
 Groups   NameVariance Std.Dev. Corr   
 box  (Intercept) 0.621046 0.78806 
  meas0.790570 0.88914  -1.000 
 Residual 0.037141 0.19272 
number of obs: 90, groups: box, 30

Fixed effects:
Estimate Std. Error t value
(Intercept)  1.794730.08353  21.487
treatB1  0.233340.11813   1.975
treatB2  0.626770.11813   5.306
treatD1  0.079110.11813   0.670
treatD2  0.439420.11813   3.720
treatU  -0.119330.11813  -1.010

Correlation of Fixed Effects:
(Intr) tretB1 tretB2 tretD1 tretD2
treatB1 -0.707
treatB2 -0.707  0.500 
treatD1 -0.707  0.500  0.500  
treatD2 -0.707  0.500  0.500  0.500   
treatU  -0.707  0.500  0.500  0.500  0.500

> anova(mod)
Analysis of Variance Table
  Df  Sum Sq Mean Sq
treat  5 2.11106 0.42221

Thanks a lot in advance



Maria Meyen
Department of Conservation Biology
Faculty of Biology
Philipps-University of Marburg
Karl-von-Frisch-Str.8
35043 Marburg



  __

Der Lieblings-Mailbox der Welt.

__
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, reproducible code.


[R] SPSS to R conversion "error in iconv..."

2008-10-21 Thread Maria Gouskova
Dear R users,

I am trying to get R to read an .sav data file generated in SPSS 17
for Mac. Here is the command and the error message:

> data = read.spss('/Users/userdir/Desktop/filename.sav')

Error in iconv(names(rval), cp, "") : unsupported conversion
In addition: Warning message:
In read.spss("/Users/userdir/Desktop/filename.sav") :
  /Users/userdir/Desktop/filename.sav: File-indicated character
representation code (28591) looks like a Windows codepage

I understand the source of the Warning message and am not too
concerned about this, but I could not find any information about this
particular Error message. Does anyone have suggestions or know how to
get around this?

This is in R 2.7.2, R.app GUI 1.25. Any help would be appreciated--I
am an R newbie.

Maria

__
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, reproducible code.


[R] emperical bayes estimates and standard error lme4

2009-02-02 Thread Maria Schipper
Dear all,
 
I am trying to get the emperical bayes estimates together with their
standard errors out of lme4. Up to now I have used MLwiN to get these
estimates. I have fitted the following - very simple - model, just to
find out how this works.
 
test<-lmer(y~(1|subject),data,REML=F)
ranef(test,postVar=T)
str(ranef(test,postVar=T)
 
If I use the formulation of the emperical bayes estimates and their
standard errors from Longford (1993), this comes down to using a
shrinkage factor based on the level 1 and 2 variance and the sample size
of the subject at hand (lambda=var(u)/{var(u)+var(e)/n}). Using the
formulas of Longford (1993), I get exactly what R is getting also. If I
fit the same model in MLwiN, the EB-estimates are the same, the
se(EB-estimates) are, however, different. Does anyone know where this
difference comes from?
 
all the best,
 
Maria Schipper
 

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] Enquiries about time plots in R

2008-11-12 Thread Lathouri, Maria
Dear all,
 
My name is Maria Lathouri and I am currently doing a PhD at Imperial College of 
London about time series of environmental variables in surface waters. I am 
trying to do some time plots with R but it seems that it is not working. 
The problem is that the time is not regular, for example, a small dataset can 
be seen below:
Date  pH
1/02/1998  5.5
5/03/1998  5
8/12/1998  6
1/02/1999  6.1
...
08/10/20007.2
 
I have used the function >plot(DATE, pH) and then >lines(pH), but the line does 
not join the points. I have used many combinations, e.g. >plot(DATE, pH) and 
then >lines(DATE, pH), where I get a plot with full of lines inside or just 
>plot(pH) and then >lines(pH) where the line connects the points but in x-axis 
I do not have the DATE. It says Index from 0 to 80. 
 
Do you know if there is a function where I can have in x-axis the DATE 
(irregular dates) and in y-axis the variable with a continuous line, showing 
how it changes through time?
 
I know that your time is valuable but I would appreciate it if you could help 
me. 
 
Thank you very much in advance for your time and help.
 
I am looking forward to hearing from you.
 
Sincerely yours 
Lathouri Maria

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] Boxplots with different variables and different ranges in R

2008-11-13 Thread Lathouri, Maria
Dear all,
 
I am trying to make boxplots in one diagram but it is not working. Actually I 
have a large dataset, around 35 water quality variables with different units 
and of course in different ranges (some are orders of magnitude bigger than 
others). I want to produce one diagram with all the boxplots of the variables 
of my dataset. 
 
I tried these series of commands:
>oldpar <- par(mfrow=c(1,ncol(R)))
> invisible(apply(R, 2,boxplot))
> for (i in 1:ncol(R)) boxplot(R[,i], main=colnames(R)[i])
> par(oldpar)

(where R is the name of my dataset)

The problem is that after the second command, there is an error in plot.new( ): 
figure margins too large. 

Is there a way to overcome this and put all my variables in a same diagram? I 
tried with less number of variables, but I had the same warning.

Thank you very much for your time and help.

Kind regards

Maria Lathouri




[[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
and provide commented, minimal, self-contained, reproducible code.


[R] Time plots

2008-11-17 Thread Lathouri, Maria
Dear all, 
I want to do some time plots and actually the dates are in the format of 
dd/mm/. So first I input my dataframe in R in a csv form. What I do is 
 
DF<-read.csv("C:/Documents and Settings/DF.csv")
DATE<-as.Date(DATE, "%d/%m/%Y")  # to tell R that DATE column is indeed dates
with(DF, plot(DATE,pH))
 
Until here it works fine, but I have the graph plotting only the points. What I 
want is to have a line (join these points) so to have a time plot. I have tried 
different commands such as lines(DATE,pH) or with(DF, lines(DATE,pH) but 
nothing works. 
 
What can I do?
 
Yours
Lathouri Maria

[[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Testing Normal Distributions

2007-11-09 Thread Maria Rizzo
Also see the tests in the energy package for univariate and multivariate 
normality (normal.etest and mvnorm.etest).

The test for univariate normality has very similar properties as the 
Anderson-Darling test.

Maria Rizzo
Dept. of Mathematics & Statistics
Bowling Green State University

At 06:57 AM 11/9/2007, Henrique Dallazuanna wrote:
>Content-Type: text/plain
>Content-Disposition: inline
>Content-length: 679
>
>?shapiro.test
>
>On 08/11/2007, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
>wrote:
> >
> >
> >
> > Hi,
> >
> > I would like to know if there is an algorithm in R for testing if a data
> > set as a normal destribution.
> >
> > Thank you for your time,
> >
> > Pedro Marques
> >
> > __
> > 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, reproducible code.
> >
>
>
>
>--
>Henrique Dallazuanna
>Curitiba-Paraná-Brasil
>25° 25' 40" S 49° 16' 22" O
>
> [[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
>and provide commented, minimal, self-contained, reproducible code.

__
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, reproducible code.


[R] R version 3.2.5

2016-07-25 Thread Maria Alice Jacques
Good night,

How can I download and install R version 3.2.5 from cran mirror of
University of São Paulo, São Paulo?

Thanks for your support.

Maria Alice P. Jacques

[[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] LM() and time in R

2015-04-29 Thread Livia Maria Vestergaard

Hello,

I need some help with a project that I’m working one.

Im trying to make a l regression model (lm) in r with time as independant 
variable and gas prices as the depended.
But It seems like everything im trying to run it, R freeze, I think that I need 
to tell R somehow that my time is time but how ?



Hope that you can help me :)
Livia
__
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 - hoslem.test

2015-04-29 Thread Luciane Maria Pilotto
Hello,

I'm working with ordinal logistic regression model (polr) and would like to 
test the proportional odds assumption. For this, I ran the binary logistic 
regressions with varying cutpoints on the dependent variable, as described in 
the following commands. When running the test of Hosmer and Lemeshow 
(hoslem.test) for residuals gives error.

Thanks,
Luciane 

__
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] help - hoslem.test

2015-04-30 Thread Luciane Maria Pilotto
load("id3.rda")
attach(id3)

#transformando q13 em binária
q131<-ifelse(q13==1,1,ifelse(q13==2,2,ifelse(q13==3,2, 
ifelse(q13==4,2,ifelse(q13==5,2,NA)
id3<-cbind(id3,q131)
id3$q131 <- as.factor(id3$q131)

tp1 <- glm(q131 ~ q11 + q10+q12+edcat + q08+q06+ q14, family = binomial(link = 
"logit"), data=id3) 
tp1

library(ResourceSelection)
hoslem.test(tp1$q131, fitted(tp1), g=10)

dataframe: https://www.dropbox.com/s/9qrdf4mhd6tzypi/id3.rda?dl=0


______
Luciane Maria Pilotto
Mestre e Doutoranda em Saúde Bucal Coletiva - FO/UFRGS 
NDE Odontologia - UNIVATES
Telefone: (51) 84512344


Em qui, 30/4/15, John Kane  escreveu:

 Assunto: RE: [R] help - hoslem.test

.org
 Data: Quinta-feira, 30 de Abril de 2015, 7:52

 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

 John Kane
 Kingston ON Canada


 > -Original Message-

 > Sent: Wed, 29 Apr 2015 18:45:26 -0700
 > To: r-help@r-project.org
 > Subject: [R] help - hoslem.test
 > 
 > Hello,
 > 
 > I'm working with
 ordinal logistic regression model (polr) and would like
 > to test the proportional odds assumption.
 For this, I ran the binary
 > logistic
 regressions with varying cutpoints on the dependent
 variable, as
 > described in the following
 commands. When running the test of Hosmer and
 > Lemeshow (hoslem.test) for residuals gives
 error.
 > 
 > Thanks,
 > Luciane
 > 
 >
 __
 > 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.

 
 FREE ONLINE PHOTOSHARING - Share your photos
[[elided Yahoo spam]]
 Visit
 http://www.inbox.com/photosharing to
 find out more!

__
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] LM() and time in R

2015-04-30 Thread Livia Maria Vestergaard
Hello guys, 
thanks for your quick reply 
I will try and specific my problem 

I have over 300.000 observations for different petrol pumps in all of Denmark 
fra 1. november 2014 - 31 january 2015
for example I have: 

petrol pump number:  "" /  date: 1. november 2014 / time: 08:14:22 / price: 
10.55 /day /   zipcode: 2000
petrol pump number:  "" /  date: 1. november 2014 / time: 08:29:00 / price: 
10.52 / day / zipcode: 2000
petrol pump number: "3456" / date: 1. november 2014 / time: 08:19:21 / price: 
10.88 / day/  zipcode: 2100


And then put the zip codes into dummy categories like X1: zipcode (1000-2000)=1 
all others 0 and so on.

My regression model then look like 

lm(price, x1 + x2 + x3 ...  ) but the "Multiple R-squared" is really low, 
0.01217 

So instead I would like to check if the time "hh:mm:ss" have an effect on the 
price. I know how to tell R about the date by as.Date() , but not with the 
time, how can I do that? 


Or do you guys maybe a third idea about what should make a regression about to 
improve the model?

Cheers 
Livia :) 


Fra: Boris Steipe [boris.ste...@utoronto.ca]
Sendt: 29. april 2015 20:25
Til: Livia Maria Vestergaard
Cc: r-help mailing list
Emne: Re: [R] LM() and time in R

Have a look at the help page for the function ts()
(type ?ts  at the R prompt).  Other than that, you haven't provided nearly 
enough information for us to diagnose your issue.

Please see here for some hints on how to ask questions productively:
http://adv-r.had.co.nz/Reproducibility.html
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
Cheers

B.

On Apr 29, 2015, at 6:26 AM, Livia Maria Vestergaard  
wrote:

>
> Hello,
>
> I need some help with a project that I’m working one.
>
> Im trying to make a l regression model (lm) in r with time as independant 
> variable and gas prices as the depended.
> But It seems like everything im trying to run it, R freeze, I think that I 
> need to tell R somehow that my time is time but how ?
>
>
>
> Hope that you can help me :)
> Livia
> __
> 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] help - hoslem.test

2015-05-05 Thread Luciane Maria Pilotto
  John Kane
 >  > Subject: Re: [R] help -
 >  hoslem.test
 >  >
 >  > Ok, in
 >  dropbox link below you can download the bank.
 >  > (https://www.dropbox.com/s/9qrdf4mhd6tzypi/id3.rda?dl=0)
 >
 >  No. Not everybody is alowed to
 >  use dropbox. Try to post result of
 >
 >  dput(id3)
 >
 >  directly to your post.
 >
 >  Cheers
 >  Petr
 >
 >  >
 >  > I change the script
 >  following the suggestions, but the error
 persists.
 >  > I used the the na.action command to delete
 >  the lost values.
 >  >
 >  >
 >
 >
 ###
 >  >
 >  >
 >  load("id3.rda")
 >  >
 >  attach(id3)
 >  >
 >  >
 >  #transformando q13 em binária (o/1)
 >  >
 > 
 q131<-ifelse(q13==1,0,ifelse(q13==2,1,ifelse(q13==3,1,
 >  > ifelse(q13==4,1,ifelse(q13==5,1,NA)
 >  > id3<-cbind(id3,q131)
 >  > id3$q131 <- as.factor(id3$q131)
 >  > str(id3)
 >  >
 >  > tp1 <- glm(q131 ~ q11 + q10+q12+edcat +
 >  q08+q06+ q14, family =
 >  > binomial(link =
 >  "logit"), data=id3,
 >  na.action="na.exclude")
 >  >
 >  tp1
 >  > hoslem.test(tp1$q131, fitted(tp1),
 >  g=10)
 >  >
 >  >
 >  >
 >  >
 >  
 >  > Em qui, 30/4/15, John Kane 
 >  escreveu:
 >  >
 >  >
 >  Assunto: Re: [R] help - hoslem.test
 >  >
 >  Para: "PIKAL Petr" ,
 >  "Luciane Maria Pilotto"
 >  >

 >  "r-help@r-project.org"
 >    > project.org>
 >  >
 >  Data: Quinta-feira, 30 de Abril de 2015, 11:51
 >  >
 >  >  Kevin Thorpe
 >  pointed out
 >  >  to me that there is a
 >  dropbox link at the very bottom of the
 >  >  post that I missed. :(
 >  >
 >  >  I
 >  >  just downloaded it, read it in and it
 >  looks fine.
 >  >
 >  >  John
 >  Kane
 >  >  Kingston ON Canada
 >  >
 >  >
 >  >  > -Original
 >  >  Message-
 >  >  >
 >  From: petr.pi...@precheza.cz
 >  >  > Sent: Thu, 30 Apr 2015 14:25:23
 >  +

 >  >  r-help@r-project.org
 >  >  > Subject: Re: [R] help -
 >  hoslem.test
 >  >  >
 >  >  > Hi
 >  >  >
 >  >  > I agree with John
 >  >  >
 >  >  > Just
 >  small
 >  >  refinements in lines
 >  >  >
 >  >  >>
 >  -Original Message-
 >  >
 >  >>> -Original Message-

 >  >  >>> Sent: Thu, 30 Apr 2015
 >  04:24:32
 >  >  -0700
 >  >
 >  >>> To: r-help@r-project.org,
 >  >  jrkrid...@inbox.com
 >  >  >>> Subject: RE: [R] help -
 >  >  hoslem.test
 >  >
 >  >>>
 >  >  >>>
 >  load("id3.rda")
 >  >  >>
 >  And what is this?
 >  >  >>
 >  >  >> We do not
 >  >  have access to your office or
 computer
 >  hard disc.
 >  >  >>
 >  >  >> Please read
 >  >  http://stackoverflow.com/questions/5963269/how-to-make-a-
 >  >  >>
 great-r-reproducible-example,
 >  see
 >  >  ?dput for sending data?
 >  >  >>
 >  >  >>
 >  It is very unlikely anyone here can
 >  >
 >  help if we have no data.
 >  >  >>
 >  >  >>
 >  >
 >  >>>
 >  >  attach(id3)
 >  >  >
 >  >  > Do
 >  >  not use attach. It prevents from
 >  modifiyng id3.
 >  >  >
 >  >  >>>
 >  >
 >  >>> #transformando q13 em binária
 >  >  >>>
 >  >
 > 
 q131<-ifelse(q13==1,1,ifelse(q13==2,2,ifelse(q13==3,2,
 >  >  >>>
 >  >
 >  ifelse(q13==4,2,ifelse(q13==5,2,NA)
 >  >  >
 >  >
 >  >  > q131 <- as.numeric(cut(q13,
 >  >  c(0,1.5,5)))
 >  >
 >  >
 >  >  >>
 >  >
 >  x<-1:7
 >  >  >> x
 >  >  >
 >  >  [1] 1 2 3 4
 >  5 6 7
 >  >  >> as.numeric(cut(x,
 >  >  c(0,1.5,5)))
 >  >  >
 >  [1]  1  2  2  2  2 NA
 >  >  NA
 >  >  >
 >  >
 >  >>>
 >  >
 >  id3<-cbind(id3,q131)
 >  >  >
 >  >  > rather dangerous in case id3 is
 >  not
 >  >  data.frame but matrix
 >  >  >
 >  >  >>>
 >  id3$q131 <-
 >  >  as.factor(id3$q131)
 >  >  >>>
 >  >
 >  >>> tp1 <- glm(q131 ~ q11 +
 >  >  q10+q12+edcat + q08+q06+ q14, family
 >  =
 >  >  >>

[R] lm model exported from R to excel

2015-05-06 Thread Livia Maria Vestergaard
Hi all
I all. I am wondering whether anybody know how to export an output of an lm 
model from R to excel in order to have excel recognize the table that comes and 
divide the numbers in the table into columns and rows? 
I really hope it is possible? :)

Best Livia  
__
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] lm model exported from R to excel

2015-05-06 Thread Livia Maria Vestergaard
Hi Duncan
Thank you so much - it worked :)

Best 

Livia

Fra: Duncan Mackay [dulca...@bigpond.com]
Sendt: 6. maj 2015 14:26
Til: R; Livia Maria Vestergaard
Emne: RE: [R]  lm model exported from R to excel

Hi Livia

There are several html packages that ?could also do it

Heres a way with xtable

library(xtable)
y = rnorm(100)
x= rnorm(100)+rnorm(100)
mod <- lm(y ~x)

# latex example easy view
xtable(mod)

# html
file.create("lm.htm")
ff <- file("lm.htm", "a+")
fchars <-  print(xtable(mod),type = "html")
writeLines(paste(fchars, sep = ""), ff)
close(ff)

You can then bring this into Microsoft as an html file

You may need to fill in some of the arguments in xtable to get the right
border format etc

If you are doing many you can make a function to do things

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mac...@northnet.com.au

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Livia Maria
Vestergaard
Sent: Wednesday, 6 May 2015 19:37
To: r-help
Subject: [R] lm model exported from R to excel

Hi all
I all. I am wondering whether anybody know how to export an output of an lm
model from R to excel in order to have excel recognize the table that comes
and divide the numbers in the table into columns and rows?
I really hope it is possible? :)

Best Livia
__
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] Output interpretation: standard error of lm dummy variable

2015-05-19 Thread Livia Maria Vestergaard
Hi guys

I have a statistical question to an analyse I ran in R. It is a dummy variable  
model with the 5 regions of Denmark as 4 independent dummy variables and price 
as the dependent variable:

price = 10.325 - 0.176*Sjaeland - 0.368 * NJylland - 0.230*MJylland - 0.120* 
Syddanmark

I understand the R^2 = 0.7348  - that it shows the explanatory force of the 
model (between 0 and 1)
My question is simply how to interpret the standard error = 0.7348 on 342199 
degrees of freedom? How is it calculated when the model is a dummy variable 
model. And what does  it mean that the F-statistic says that there are 1894 on 
4 and 342199 DF (degrees if freedom?) with a p-value < 0?

I have been searching for hours - and can't quite figure out how R reached the 
numbers and how to interpret the output of standard error and the p-value of 
the dummy model.

I really hope you can help :)

Best Livia __
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] Urgent :) Output interpretation: standard error of lm dummy variable

2015-05-19 Thread Livia Maria Vestergaard
Hi :)

I have an an examination tomorrow, and don't quite understand how R calculated 
the values. 

Yes. You are right R^2=0.02166 :)
As mentioned It is a dummy variable  model with the 5 regions of Denmark as 4 
independent dummy variables and price as the dependent variable. 

 price = 10.325 - 0.176*Sjaeland - 0.368 * NJylland - 0.230*MJylland - 0.120* 
Syddanmark

I will probably be asked how to interpret the standard error = 0.7348 on 342199 
degrees of freedom (= 342 204 observations - 5 categories); about the 5 
standard errors for the beta values, the F-statistic = 1894 on 4 categories and 
the p-value ≈ 0. But I don't quite understand how R reached the outputs and 
what parameter are F-distributed, what the standard errors says something about 
and the standard errors and the F-statistic = 1894  when it is a dummy variable 
model. 

Hopefully the answer is out there somewhere  and you can help :)

Best  Livia

Fra: Livia Maria Vestergaard
Sendt: 19. maj 2015 10:16
Til: r-help@r-project.org
Emne: [R] Output interpretation: standard error of lm dummy variable

Hi guys

I have a statistical question to an analyse I ran in R. It is a dummy variable  
model with the 5 regions of Denmark as 4 independent dummy variables and price 
as the dependent variable:

price = 10.325 - 0.176*Sjaeland - 0.368 * NJylland - 0.230*MJylland - 0.120* 
Syddanmark

I understand the R^2 = 0.7348  - that it shows the explanatory force of the 
model (between 0 and 1)
My question is simply how to interpret the standard error = 0.7348 on 342199 
degrees of freedom? How is it calculated when the model is a dummy variable 
model. And what does  it mean that the F-statistic says that there are 1894 on 
4 and 342199 DF (degrees if freedom?) with a p-value < 0?

I have been searching for hours - and can't quite figure out how R reached the 
numbers and how to interpret the output of standard error and the p-value of 
the dummy model.

I really hope you can help :)

Best Livia
__
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] clm funtion and CI

2015-07-08 Thread Luciane Maria Pilotto
Hi,

I'm working with ordinal logistic regression and fitting the model with the 
"clm" funtion of the ordinal package and would like to get the CI. According to 
the Tutorial on fitting Cumulative Link Models with the ordinal Package, Rune 
Haubo B Christensen (21 January 2015) you can run the OR, but not CI. The same 
happens with the "clm2" for partial proportional odds.

I appreciate any help !!


Luciane

__
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] clm funtion and CI

2015-07-10 Thread Luciane Maria Pilotto
 1L, 
    1L, 2L, 1L, 1L, 1L, 1L, 1L), q12 = c(NA, NA, 2L, 4L, 1L, 
    3L, 1L, 4L, 2L, 1L), q13 = structure(c(NA, NA, 2L, 3L, 2L, 
    3L, 2L, 2L, 2L, 2L), .Label = c("1", "2", "3", "4", "5"), class = 
"factor"), 
    q14 = c(3L, 2L, 3L, 4L, 2L, 2L, 4L, 3L, 4L, 2L), q15 = c(1L, 
    1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), edcat = c(3, 1, 4, 2, 
    3, 3, 2, 4, 2, 2), peso = c(291, 291, 291, 291, 291, 291, 
    291, 291, 68, 68), cariado = c(3L, 0L, 6L, 2L, 0L, 2L, 1L, 
    4L, 5L, 3L), getar = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1)), .Names = c("regiao", 
"estado", "cod_mun", "setor", "cap_int", "idade", "getario", 
"sexo", "grp_etni", "quest_01", "quest_02", "density", "quest_03", 
"quest_04", "inc_percapita1", "inc_percapita2", "inc_sqrt1", 
"inc_sqrt2", "q05", "quest_06", "quest_07", "quest_08", "quest_09", 
"quest_10", "quest_11", "quest_12", "quest_13", "quest_14", "quest_15", 
"exame", "cpod", "p_sang", "p_calc", "cpi_max", "dai", "trauma", 
"n_higido", "n_cariado", "n_restcar", "n_restaur", "n_perdcar", 
"n_perdout", "perdidos", "usaprots", "usaproti", "necprots", 
"necproti", "necprot", "oidp", "f1", "f2", "f3", "f", "bwgr_et", 
"cluster", "cluster2", "getni", "q04", "q06", "q07", "q08", "q10", 
"q11", "q12", "q13", "q14", "q15", "edcat", "peso", "cariado", 
"getar"), row.names = c("1241", "1242", "1243", "1244", "1245", 
"1246", "1247", "1248", "1256", "1268"), class = "data.frame")


id3$q13<-as.factor(id3$q13)
m1 <- polr(q13 ~ q11 + q10 + q12 + edcat + q08 + q06 + q14, data=id3, 
Hess=TRUE) 
summary(m1)
ordinal.or.display(m1)


fm1 <- clm(q13 ~ q11 + q10 + q12 + edcat + q08 + q06 + q14, data=id3) 

summary(fm1)
exp(coef(fm1)) 

[[elided Yahoo spam]]
(ci <- confint(fm1))
exp(cbind(OR = coef(fm1), ci))


nominal_test(fm1)# test partial proportional odds assumption

##clm2 - partial proprotional odds

fm.nom <- clm2(q13 ~ q11 + q10 + q12 + q08 + q06 + q14, data=id3, nominal=~ 
edcat)
summary(fm.nom)
exp(coef(fm.nom))
[[elided Yahoo spam]]
exp(cbind(OR = coef(fm.nom), ci))

Thanks,
Luciane

Em qui, 9/7/15, Kevin Wright  escreveu:

 Assunto: Re: [R] clm funtion and CI

 Data: Quinta-feira, 9 de Julho de 2015, 11:44

 You need a reproducible
 example.

 On Wed, Jul 8, 2015 at 7:43
 PM, Luciane Maria Pilotto

 wrote:
 > Hi,
 >
 > I'm working with ordinal logistic
 regression and fitting the model with the "clm"
 funtion of the ordinal package and would like to get the CI.
 According to the Tutorial on fitting Cumulative Link Models
 with the ordinal Package, Rune Haubo B Christensen (21
 January 2015) you can run the OR, but not CI. The same
 happens with the "clm2" for partial proportional
 odds.
 >
 > I appreciate
 any help !!
 >
 >
 > Luciane
 >
 >
 __
 > 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.



 -- 
 Kevin Wright

__
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] External validation for a hurdle model (pscl)

2019-01-08 Thread Maria Eugenia Utgés
Hi R-list,
We have constructed a hurdle model some time ago.
Now we were able to gather new data in the same city (38 new sites), and
want to do an external validation to see if the model still performs ok.
All the books and lectures I have read say its the best validation option
but...
I have made a (simple) search, but it seems that as having new data for a
model is rare, have not found anything with the depth enough so as to
reproduce it/adapt it to hurdle models.

I have predicted the probability for non-zero counts
nonzero <- 1 - predict(final, newdata = datosnuevos, type = "prob")[, 1]

and the predicted mean from the count component
countmean <- predict(final, newdata = datosnuevos, type = "count")

I understand that "newdata" is taking into account the new values for the
independent variables (environmental variables), is it?

So, I have to compare the predicted values of y (calculated with the new
values of the environmental variables) with the new observed values.

That would be using the model (constructed with the old values), having as
input the new variables, and having as output a "new" prediction, to be
contrasted with the "new" observed y.

These comparison would be by means of AUC, correct classification, and/or
what other options? Results of the external validation would just be a % of
correct predicted values? plots?

Need some guidance, sorry if the explanation was "basic" but needed to
write it in my own words so as not to miss any detail.

Thank you very much in advance,

María Eugenia Utgés

CeNDIE-ANLIS
Buenos Aires
Argentina
a

[[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] External validation for a hurdle model (pscl)

2019-01-09 Thread Maria Eugenia Utgés
Hi Jeff,
Yes, my question is more general perhaps
Not about R programming, data exploration, or statistical theory.
Just that in modelling texts external validation is set as "panacea" but
"unreacheable", so they explain other methods as cross validation,
bootstrapping, etc.
Here I have new data for a previously constructed model (and already
internally validated by bootstrapping), but have not found how to correctly
and sufficiently make the external validation and by which means (all ends
in just a plot? a % of correct classification?)

El mar., 8 ene. 2019 a las 17:08, Jeff Newmiller ()
escribió:

> That said, the gist of the OP's outline is correct, and the main reason to
> look elsewhere is to get more thorough advice on what statistical concerns
> should be addressed than would be on topic here.
>
> One comment: reviewing plots of differences versus various independent
> variables for systematic biases is a task R is particularly well suited
> for, but discovering which plots highlight issues with your model or data
> takes familiarity with your data (explore) and with theory (which you learn
> elsewhere) and with R (which we can help with if you have more specific
> questions).
>
> On January 8, 2019 10:50:14 AM PST, Bert Gunter 
> wrote:
> >This list is (mostly) about R programming. Your query is (mostly) about
> >statistics. So you should post on a statistics site like
> >stats.stackexchange.com
> >not here; I am pretty sure you'll receive lots of answers there.
> >
> >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 Tue, Jan 8, 2019 at 10:18 AM Maria Eugenia Utgés
> >
> >wrote:
> >
> >> Hi R-list,
> >> We have constructed a hurdle model some time ago.
> >> Now we were able to gather new data in the same city (38 new sites),
> >and
> >> want to do an external validation to see if the model still performs
> >ok.
> >> All the books and lectures I have read say its the best validation
> >option
> >> but...
> >> I have made a (simple) search, but it seems that as having new data
> >for a
> >> model is rare, have not found anything with the depth enough so as to
> >> reproduce it/adapt it to hurdle models.
> >>
> >> I have predicted the probability for non-zero counts
> >> nonzero <- 1 - predict(final, newdata = datosnuevos, type = "prob")[,
> >1]
> >>
> >> and the predicted mean from the count component
> >> countmean <- predict(final, newdata = datosnuevos, type = "count")
> >>
> >> I understand that "newdata" is taking into account the new values for
> >the
> >> independent variables (environmental variables), is it?
> >>
> >> So, I have to compare the predicted values of y (calculated with the
> >new
> >> values of the environmental variables) with the new observed values.
> >>
> >> That would be using the model (constructed with the old values),
> >having as
> >> input the new variables, and having as output a "new" prediction, to
> >be
> >> contrasted with the "new" observed y.
> >>
> >> These comparison would be by means of AUC, correct classification,
> >and/or
> >> what other options? Results of the external validation would just be
> >a % of
> >> correct predicted values? plots?
> >>
> >> Need some guidance, sorry if the explanation was "basic" but needed
> >to
> >> write it in my own words so as not to miss any detail.
> >>
> >> Thank you very much in advance,
> >>
> >> María Eugenia Utgés
> >>
> >> CeNDIE-ANLIS
> >> Buenos Aires
> >> Argentina
> >> a
> >>
> >> [[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.
> >>
> >
> >   [[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.
>
> --
> Sent from my phone. Please excuse my brevity.
>

[[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] Glmnet penalty.factor with multigaussian response

2015-11-18 Thread Maria Vila Casadesús
Hi all,
I'm trying to use glmnet with penalty factors in a multigaussian response
model.

In case of the gaussian response the input for penalty factors is a vector,
but I haven't figured out how can I use penalty factors with a
multigaussian response, and even if it's possible. I've tried to use a
matrix of values, it doesn't give any error or warning but it seems to be
using only part of the data: the first column.

Do you know if it's possible to use penalty factors in this case? Or are
there any other alternatives?

So far, I've tried this:

cv<-cv.glmnet(x,y,alpha=.5,family = "mgaussian", penalty.factor=pen.matrix.tot)

Where:

> dim(x)[1]  40 723> dim(y)[1] 40  7

Penalty matrix looks like:

> pen.matrix.tot[1:5,1:5]
NAT2 CYP1A2 CYP2A6 CYP2A7 CYP2A13
hsa-let-7a 1  0  1  1   1
hsa-let-7a*1  1  1  1   1
hsa-let-7b 0  0  1  1   1
hsa-let-7b*1  1  1  1   1
hsa-let-7c 0  0  1  1   1
> dim(pen.matrix.tot)[1] 723   7

The coefficients for lambda.min:

 > fullcoefs[1:5,1:5]
NAT2  CYP1A2   CYP2A6 CYP2A7 CYP2A13
 hsa-let-7a   NA  NA   NA NA  NA
 hsa-let-7a*  NA  NA   NA NA  NA
 hsa-let-7b   0.10222788  0.06621902  0.064668084  0.3887164  0.06369455
 hsa-let-7b*  NA  NA   NA NA  NA
 hsa-let-7c  -0.06436899 -0.03362183 -0.007440406 -0.2581606
-0.01517728> dim(fullcoefs)[1] 723   7


More speciffically, in this case I would expect some value for
"hsa-let-7a":"CYP1A2", as the penalty for it is 0.

Many thanks!

Maria

[[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] Use of R for estimation of Discrete Choice Models incorporating latent variables

2015-12-09 Thread Maria Alice Jacques
Dear all,

I would like to know if it is possible to estimate an integrated choice and
latent variable model with R. If it is so, please send me the name of the
respective package.

Best regards,

Maria Alice P. Jacques
Associated Researcher
University of Brasilia - Brazil

[[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] Theta in Negative binomial GAM

2017-02-26 Thread Eva Maria Leunissen
Hi, I'm fitting a negative binomial GAM (using mgcv) to my data using
family=nb() so theta is estimated during the fitting process. When I then
extract this theta from the model and refit the same model with
family=negbin(theta) it gives a much lower AIC. I know using AIC to compare
negative binomial models should be done with caution (
http://r.789695.n4.nabble.com/How-to-compare-GLM-and-GAM-models-tt827923.html#a827926)
but approximately it is ok. My questions are:

Is it better to do model selection with nb() or with negbin and a known
theta. if the latter how do you know what theta is?

can you compare models using AIC if the theta is different for each model?

Thanks in advance, any help is much appreciated

Kind regards,

Eva Leunissen

[[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] concurvity

2017-02-27 Thread Eva Maria Leunissen
Hi, I'm using the concurvity function to check for concurvity in my model.
The output I get when comparing to the rest of the model (ie full=TRUE)
 many of the variables have concurvity values higher than 0.9. However when
comparing the terms pairwise most values are very small, less than 0.1
(with the worst around 0.5). I am not sure where to go from here, should
the full model output be cause for concern and should I refit the model
eliminating some terms with high concurvity? or are the pairwise
concurvities more informative?
is there anything else I can do? The terms in the model are mostly
interactions, with a few smooths and one parametric term.

Thanks in advance

[[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] Negative binomial GAMM using 'by' in factor interactions

2017-03-09 Thread Eva Maria Leunissen
I am using a GAMM to model my data (this is as far as I know the only way I
can use the negative binomial distribution AND a correlation structure
within the model).

I measured animal detections (including zero detections) per hour at 3
different locations in an area. location is a factor in my model and the
other possible explanatory variables are environmental variables and level
of disturbance.

I'm expecting the response to be different at the 3 different locations for
each variable so have been modelling the terms as interactions with each of
the 3 factor levels of location using the 'by' argument in the 'ti'
smoothing term, as well as 'location' as a variable by itself. Does it make
sense to include the main effect as well as the interaction term? for
example for including the variable 'windspeed': if including the term
ti(windspeed, by=location), is it necessary to also include s(windspeed)?
or would it only make sense to inlcude them in separate models only and
compare the models?

As far as I understand the 'by' argument calculates a separate smooth for
each of the factor levels, so if the effect was the same at each location
it wouldn't hurt to use the 'ti' smooth with the 'by' argument if the
effect of the variable was the same at each location.

The issue I'm having is that by including both terms and then doing model
selection gives me many very similar models within a deltaAIC of 6 of the
best model, where the differences lie in the inclusion of main effects when
the 'interaction' is also there. The inclusion of the interaction term
gives bigger changes in AIC compared to the inclusion of the main effect.

This brings me to my other question. Is it possible to compare GAMMs with a
negative binomial family using AIC? e.g. using AIC(mod$lme). If not, what
is the best way to compare them?

Thank you very much for your time

[[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] Installing R on Ubuntu 8.10

2009-05-16 Thread Maria I. Tchalakova
Hi,

I am trying to install R on Ubuntu 8.10. I have added this line:

deb http://cran.at.r-project.org/bin/linux/ubuntu intrepid/

in my /etc/apt/sources.list file. However when I "Reload", I get the
following error message:
W: GPG error: http://cran.at.r-project.org intrepid/ Release: The
following signatures couldn't be verified because the public key is
not available: NO_PUBKEY D67FC6EAE2A11821

I have tried different mirror sites, but the result is the same. There
is nothing written about public keys on the download page:
http://cran.at.r-project.org/

Then, I have tried (after I added the line to the
/etc/apt/sources/list file) not pressing "Reload", but "Close", and I
have written in the console:
sudo apt-get update

but I received similar message again:

Reading package lists... Done
W: GPG error: http://cran.rakanu.com intrepid/ Release: The following
signatures couldn't be verified because the public key is not
available: NO_PUBKEY D67FC6EAE2A11821
W: You may want to run apt-get update to correct these problems

Do you know what the problem is, and what should I do? Thanks in advance.

Maria

__
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, reproducible code.


Re: [R] Installing R on Ubuntu 8.10

2009-05-16 Thread Maria I. Tchalakova
Hi Dan,

thanks for the reply. Yes, I have read everything there, but it didn't
help. I've written to the Ubuntu forums as well, from where I was told
to type first:

> gpg --keyserver keyserver.ubuntu.com --recv D67FC6EAE2A11821
> gpg --export --armor D67FC6EAE2A11821 | sudo apt-key add -

before
> sudo apt-get update
> sudo apt-get install r-base

and it worked.

Best,
Maria



On Sat, May 16, 2009 at 11:52 AM, Nordlund, Dan (DSHS/RDA)
 wrote:
>> -Original Message-
>> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
>> Behalf Of Maria I. Tchalakova
>> Sent: Saturday, May 16, 2009 2:37 AM
>> To: R-help Forum
>> Subject: [R] Installing R on Ubuntu 8.10
>>
>> Hi,
>>
>> I am trying to install R on Ubuntu 8.10. I have added this line:
>>
>> deb http://cran.at.r-project.org/bin/linux/ubuntu intrepid/
>>
>> in my /etc/apt/sources.list file. However when I "Reload", I get the
>> following error message:
>> W: GPG error: http://cran.at.r-project.org intrepid/ Release: The
>> following signatures couldn't be verified because the public key is
>> not available: NO_PUBKEY D67FC6EAE2A11821
>>
>> I have tried different mirror sites, but the result is the same. There
>> is nothing written about public keys on the download page:
>> http://cran.at.r-project.org/
>>
>> Then, I have tried (after I added the line to the
>> /etc/apt/sources/list file) not pressing "Reload", but "Close", and I
>> have written in the console:
>> sudo apt-get update
>>
>> but I received similar message again:
>> 
>> Reading package lists... Done
>> W: GPG error: http://cran.rakanu.com intrepid/ Release: The following
>> signatures couldn't be verified because the public key is not
>> available: NO_PUBKEY D67FC6EAE2A11821
>> W: You may want to run apt-get update to correct these problems
>>
>> Do you know what the problem is, and what should I do? Thanks in advance.
>>
>> Maria
>>
>
> Maria,
>
> Go to the CRAN website (or your preferred mirror), select Linux under the 
> download and install section, then select Ubuntu, and read what it says about 
> installation.
>
> http://cran.r-project.org/
>
> Hope this is helpful,
>
> Dan
>
> Daniel J. Nordlund
> Washington State Department of Social and Health Services
> Planning, Performance, and Accountability
> Research and Data Analysis Division
> Olympia, WA  98504-5204
>
>
>

__
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, reproducible code.


[R] R interpreter not recognized

2009-04-09 Thread Maria I. Tchalakova
Hello,

I am trying to install a program based on R, but I am receiving the
following error message:
r...@darkstar:/home/maria/UCS# perl System/Install.perl
Error: Can't run the R interpreter (/usr/local/bin/R).
Please make sure that R is installed and specify the fully qualified
filename of the R interpreter with -R if necessary (see "doc/install.txt").

I do have installed R, and I can see it (it is working also fine when I use it):
> which R
> /usr/local/bin/R
I have specified the location of the R interpreter with -R (or -rh)
/usr/local/bin/R" when running the program, but it still doesn't work.
I have also used -R /usr/local/lib/R/bin/R or -rh
/usr/local/lib/R/bin/R.
I have also added the locations to my search path.

It seems that the problem comes from my environment, but I cannot
figure out what's wrong. Do you have any clues why the interpreter
cannot be found?
Thank you.

__
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, reproducible code.


Re: [R] R interpreter not recognized

2009-04-09 Thread Maria I. Tchalakova
Hi Paul,

I am using Slackware 12.0.0.

Maria

On Thu, Apr 9, 2009 at 2:35 PM, Paul Smith  wrote:
> On Thu, Apr 9, 2009 at 9:01 AM, Maria I. Tchalakova
>  wrote:
>> I am trying to install a program based on R, but I am receiving the
>> following error message:
>> r...@darkstar:/home/maria/UCS# perl System/Install.perl
>> Error: Can't run the R interpreter (/usr/local/bin/R).
>> Please make sure that R is installed and specify the fully qualified
>> filename of the R interpreter with -R if necessary (see "doc/install.txt").
>>
>> I do have installed R, and I can see it (it is working also fine when I use 
>> it):
>>> which R
>>> /usr/local/bin/R
>> I have specified the location of the R interpreter with -R (or -rh)
>> /usr/local/bin/R" when running the program, but it still doesn't work.
>> I have also used -R /usr/local/lib/R/bin/R or -rh
>> /usr/local/lib/R/bin/R.
>> I have also added the locations to my search path.
>>
>> It seems that the problem comes from my environment, but I cannot
>> figure out what's wrong. Do you have any clues why the interpreter
>> cannot be found?
>
> Maria: what is the Linux distribution that you are using?
>
> Paul
>

__
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, reproducible code.


[R] Question about the package "MatchIt"

2020-10-09 Thread Maria Cristina Maurizio
Hi! I'm trying to perform propensity score matching on survey data and so
for each individual observation I have a statistical weight attached. My
question is: is there a way within the package to consider these weights in
the matching procedure?
Thank you very much.

-- 
Maria Cristina Maurizio

[[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] different dimensions in W and my data in moran and spatial model

2021-04-14 Thread maria jesus herrerias
Hello everyone,

I am writing my code in R to run the spatial models. I am learning this
at the moment.
I have my data for 116 countries over the period 1990-2014,
and I got the shapefile from the website below.
The objective is to get the matrix to run the spatial models.
In the code below, I can get the matrix for the world and also for the
subsample.
But when I try to run the moran test or sar model I get an error.
The error is related to the dimension of W (listw) and my dataset. So
any help,
I would be grateful.

Below my code just in case someone can help  here.

# Load the required Packages.

`library(spdep)  # Spatial Dependence: Weighting Schemes,
Statistics
`library(rgdal)  # to read shapefiles

#shapefiles (world map from diva-gis)

   # Read the panel data from stata format for the regression analysis
below.

`library(foreign)

`mydata <- read.dta("C:/Users/Usuario/Desktop/instituciones/revision
energy economics/
 spatial  panel in stata/countries_shp/neworiginal.dta")

`fix(mydata)
`attach(mydata)

my data contains 116 countries from 1990 to 2014 in panel.

# Prepare the dataset for panel data analysis in R.

`library(plm)

`mydata <- pdata.frame(mydata, index = c("id", "year"))


# Read the shapefile and set up the working directory.

`setwd("C:/Users/Usuario/Desktop/instituciones/revision energy
economics/spatial panel in stata/countries_shp")

`worlddata <- readOGR("countries.shp")
`names(worlddata)
`summary(worlddata)

# Get the centroids

`coords <-coordinates(worlddata)

A. Contiguity based relations

 1. First Order Queen Contiguity

`queen.nb = poly2nb(worlddata, queen=TRUE)
`summary(queen.nb)
`plot(queen.nb,coords)


# the numbers of neighbours of regions in the neighbours list.

`cards <- card(queen.nb)

# convert into a listw type based on contiguity row normalized

`queen.listw <- nb2listw(queen.nb,style="W", zero.policy = TRUE)
`summary(queen.listw,zero.policy=TRUE)

#marginal effects
`impacts(reg2, listw = listw1,zero.policy=TRUE)

#marginal effects with p-values
`summary(impacts(reg2, listw = listw1), R= 500, zstats =
TRUE,zero.policy=TRUE)

`attributes(queen.listw)

 #Selection of a subset of countries to fit with mydataset (116
countries, the previous ones I did for all countries in the shapefile)


`setwd("C:/Users/Usuario/Desktop/instituciones/revision energy
economics/spatial panel in stata/countries_shp")

`worlddata <- readOGR("countries.shp")

`queen.nb = poly2nb(worlddata, queen=TRUE)

`coords <-coordinates(worlddata)

`plot(queen.nb, coords)


Following Roger Bivand example:

`to.be.dropped <- c(1, 2, 5, 6, 8, 9, 10, 13, 14, 18, 20, 21, 23, 26,
28, 29, 31, 34, 36, 37, 39, 40, 41, 45, 46, 47, 48, 51, 52, 53, 55, 56, 58,
59, 62, 63, 64, 66, 68, 69, 74, 75, 77, 78, 79, 80, 81, 82, 85, 86, 87, 89,
90, 94, 95, 97, 98, 99, 100, 102, 103, 104, 105, 107, 109, 110, 118, 123,
124, 125, 127, 130, 131, 133, 134, 137, 138, 139, 140, 143, 145, 146, 148,
149, 151, 152, 153, 155, 157, 159, 161, 162, 166, 167, 170, 173, 175, 176,
177, 178, 181, 182, 183, 184, 186, 190, 193, 194, 195, 198, 199, 200, 201,
202, 203, 204, 205, 206, 207, 208, 211, 212, 213, 215, 216, 218, 219, 221,
222, 224, 226, 227, 228, 229, 232, 233, 237, 239, 240, 242, 246, 247, 248,
255, 258, 259, 260, 261, 265)
sub.queen.nb <- subset(queen.nb,
  !(1:length(queen.nb) %in% to.be.dropped))
which(!(attr(queen.nb, "region.id") %in%
  attr(sub.queen.nb, "region.id")))

`sub.queen.listw <- nb2listw(sub.queen.nb,style="W", zero.policy = TRUE)

so now, I have my 116 countries in the queen matrix.

# My data and variables
`y <- cbind(lei)
`x <- cbind(lgdppcnew, lgdppcnew2, industryg, importsg, fdig)
`xy <- cbind(mydata$x, mydata$y)
`listw1 <- sub.queen.listw
`coords <- coords

#Define formula

`reg.ols <- y ~ x


# Autocorrelation test
`lm.morantest(ols.eq1,listw1,zero.policy=TRUE)
`plot.moran(ols.eq1,listw1)

(here I get the error where it is said the objects have different
dimensions)

`reg2 <- lagsarlm(ols.eq1, data = mydata, listw1, zero.policy=TRUE)
`summary(reg2,correlation=TRUE, Nagelkerke=TRUE, Hausman=TRUE,
zero.policy=TRUE)

(here I get the error where it is said the objects have different
dimensions)

 #marginal effects

`impacts(reg2, listw = listw1,zero.policy=TRUE)

 #marginal effects with p-values

 `summary(impacts(reg2, listw = listw1), R= 500, zstats =
TRUE,zero.policy=TRUE)

 I don't know if it is for my panel data, the missing values or
something else.
 I tried also in Stata having sim

[R] Unsubscribe from mailing list please

2022-11-01 Thread Eva Maria Leunissen
Hi,

Could I please unsubscribe from the R-help mailing list?

Thanks

Eva

[[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] How do I get a a p-value for the output of an lme model with lme4?

2013-07-26 Thread Maria Sol Lago
Hi there,

I just started using lme4 and I have a question about obtaining p-values. I'm 
trying to get p-values for the output of a linear mixed-effects model. In my 
experiment  I have a 2 by 2 within subjects design, fully crossing two factors, 
"Gram" and "Number". This is the command I used to run the model:

>m <- lmer(RT ~ Gram*Number + (1|Subject) + (0+Gram+Number|Subject) + 
(1|Item_number),data= data)

If I understand this code, I am getting coefficients for the two fixed effects 
(Gram and Number) and their interaction, and I am fitting a model that has 
by-subject intercepts and slopes for the two fixed effects, and a by-item 
intercept for them. Following Barr et al. (2013), I thought that this code gets 
rid of the correlation parameters. I don't want estimate the correlations 
because I want to get the p-values using pvals.fnc (), and I read that this 
function doesn't work if there are correlations in the model.

The command seems to work:

>m
Linear mixed model fit by REML 
Formula: RT ~ Gram * Number + (1 | Subject) + (0 + Gram + Number | Subject) 
+ (1 |Item_number) 
   Data: mverb[mverb$Region == "06v1", ] 
   AIC   BIC logLik deviance REMLdev
 20134 20204 -1005420138   20108
Random effects:
 Groups  NameVariance  Std.Dev. Corr  
Item_number (Intercept)   273.508  16.5381   
 Subject Gramgram0.000   0.   
 Gramungram   3717.213  60.9689NaN
 Number159.361   7.7046NaN -1.000 
 Subject (Intercept) 14075.240 118.6391   
 Residual35758.311 189.0987   
Number of obs: 1502, groups: Item_number, 48; Subject, 32

Fixed effects:
 Estimate Std. Error t value
(Intercept)402.520 22.321  18.033
Gram1  -57.788 14.545  -3.973
Number1 -4.191  9.858  -0.425
Gram1:Number1   15.693 19.527   0.804

Correlation of Fixed Effects:
(Intr) Gram1  Numbr1
Gram1   -0.181  
Number1 -0.034  0.104   
Gram1:Nmbr1  0.000 -0.002 -0.011

However, when I try to calculate the p-values I still get an error message:

>pvals.fnc(m, withMCMC=T)$fixed
Error in pvals.fnc(m, withMCMC = T) : 
MCMC sampling is not implemented in recent versions of lme4
  for models with random correlation parameters

Am I making a mistake when I specify my model? Shouldn't pvals.fnc() work if I 
removed the correlations?

Thanks for your help!

--Sol
__
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, reproducible code.


[R] merge multi part polygons

2013-09-11 Thread Maria Fernanda Bonetti
I need to extract climatic variables of many shapefiles. I managed to do it, 
but doing one at a time (I have to do this for 3000 species).
Well, I did the following:
first I downloaded the rasters of BIOCLIM> bios <-getData ("Worldclim" var = 
"bio", res = 2.5, T = download)
Ok, then I went with shapes (2 species did just to test).> teste_sp1 
<-readShapePoly ("sp1", IDVAR = NULL, proj4string = CRS (as.character (NA)), 
verbose = FALSE, repair = FALSE, FALSE = force_ring, delete_null_obj = FALSE, 
retrieve_ABS_null = FALSE)
Finally, I used a function to extract the variables of shapes> v <- extract 
(bios, sp1)

THE PROBLEM:The sp1 is a multi part polygon (23 features). I could make the 
average of these 23 lines and everything would be ok right? The problem is that 
some lines appears NA, and I have no idea why, and I can not just ignore that.
Do I need to join these parts into a single polygon? I tried this with 
"unionSpatialPolygons" but another error appears: Error in unionSpatialPolygons 
(sp1, IDS, threshold = NULL,: input lengths differ
Can anyone help me?

Att,
Maria Fernanda BonettiDoutoranda do Programa de Pós Graduação em Ecologia e 
Conservação - UFPRMestre em Ecologia e ConservaçãoPesquisadora do Instituto de 
Pesquisas Cananéia - IPeC  
[[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
and provide commented, minimal, self-contained, reproducible code.


[R] Installation of rJava package fails

2013-02-05 Thread Loesch, Uta Maria
Hi,

I am trying to install the rJava package in a Linux environment (Platform: 
x86_64-suse-linux-gnu (64-bit)), where I am facing an issue which I cannot 
solve so far and where I could require some help:

The installation seems to go fine, however in the last step of the installation 
where loading the package is tested, the process fails with the following error:
** testing if installed package can be loaded
Error : .onLoad failed in loadNamespace() for 'rJava', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object 
'/usr/lib64/R/library/rJava/libs/rJava.so':
  /usr/lib64/R/library/rJava/libs/rJava.so: undefined symbol: R_BadLongVector
Error: loading failed
Execution halted
ERROR: loading failed
* removing '/usr/lib64/R/library/rJava'

I have attached the complete output of the installation process.

Here is the output of sessionInfo():
> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-suse-linux-gnu (64-bit)

locale:
[1] C

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

loaded via a namespace (and not attached):
[1] tools_2.15.2


and of javareconf:
R CMD javareconf
Java interpreter : /usr/sap/jdk1.6.0_18//jre/bin/java
Java version : 1.6.0_18
Java home path   : /usr/sap/jdk1.6.0_18/
Java compiler: /usr/sap/jdk1.6.0_18//bin/javac
Java headers gen.: /usr/sap/jdk1.6.0_18//bin/javah
Java archive tool: /usr/sap/jdk1.6.0_18//bin/jar
Java library path: 
/usr/sap/jdk1.6.0_18/jre/lib/amd64/server:/usr/sap/jdk1.6.0_18/jre/lib/amd64:/usr/sap/jdk1.6.0_18/jre/../lib/amd64::/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
JNI linker flags : -L/usr/sap/jdk1.6.0_18/jre/lib/amd64/server 
-L/usr/sap/jdk1.6.0_18/jre/lib/amd64 -L/usr/sap/jdk1.6.0_18/jre/../lib/amd64 -L 
-L/usr/java/packages/lib/amd64 -L/usr/lib64 -L/lib64 -L/lib -L/usr/lib -ljvm
JNI cpp flags: -I/usr/sap/jdk1.6.0_18//include 
-I/usr/sap/jdk1.6.0_18//include/linux

Updating Java configuration in /usr/lib64/R
Done.

To me, the paths seem fine, an internet search did not deliver any results. Any 
suggestions how to proceed on the problem?
What is the R_BadLongVector? I could not find any information wrt. that online.

Thanks in advance for your help!
Uta


Dr. Uta Lösch
Co-Innovation Development
TIP Customer Engagement & Strategic Projects
SAP AG
Dietmar-Hopp-Allee 16
69190 Walldorf, Germany
T +49 6227 7-46995

g *source* package 'rJava' ...
** package 'rJava' successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc -std=gnu99 supports static inline...
yes
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/sap/jdk1.6.0_18//jre/bin/java'
archiver: '/usr/sap/jdk1.6.0_18//bin/jar'
compiler: '/usr/sap/jdk1.6.0_18//bin/javac'
header prep.: '/usr/sap/jdk1.6.0_18//bin/javah'
cpp flags   : '-I/usr/sap/jdk1.6.0_18//include 
-I/usr/sap/jdk1.6.0_18//include/linux'
java libs   : '-L/usr/sap/jdk1.6.0_18/jre/lib/amd64/server 
-L/usr/sap/jdk1.6.0_18/jre/lib/amd64 -L/usr/sap/jdk1.6.0_18/jre/../lib/amd64 -L 
-L/usr/java/packages/lib/amd64 -L/usr/lib64 -L/lib64 -L/lib -L/usr/lib -ljvm'
checking whether JNI programs can be compiled... yes
checking JNI data types... ok
checking whether JRI should be compiled (autodetect)... yes
checking whether debugging output should be enabled... no
checking whether memory profiling is desired... no
checking whether threads support is requested... no
checking whether callbacks support is requested... no
checking whether JNI cache support is requested... no
checking whether JRI is requested... yes
config

[R] Make cdf package error Human Exon array

2013-04-03 Thread Maria Arnedo Munoz

Hello everybody!

I am not sure if this is the way for asking because I am new in this  
kind of "help-website" so, please if I am wrong tell me.


I am trying to make a cdf package for the Human Exon Array chip from  
Affymetrix (HuEx-1_0-st-v2). I have downloaded the file  
HuEx-10-st-v2.cdf from the Affymetrix website and write the following  
commands in the R program:


library(makecdfenv)
pkgpath<-tempdir()
make.cdf.package("HuEx-1_0-st-v2.text.cdf",cdf.path="/Working/",compress=F,  
species = "Homo_sapiens", package.path = pkgpath)


It costs me a lot of time and most of the RAM memory of my computer  
and at the end the following message appears:


Reading CDF file.
Error in .Call("reaD file", as.character(file), as.integer(3),
as.integer(compress), :promise already under evaluation: recursive default
argument reference or earlier problems?

I have no idea if I am doing anything wrong or if there is a better  
method for making the package, so any help will be really welcome.


Thank you,

Maria

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

__
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, reproducible code.


[R] polycor package

2012-11-16 Thread Laura Maria Schwirz
I am currently working with R's polycor package and I have encountered a
problem. I tried to follow the steps as outlined in the sem.pdf file where
a CFA model is run using polychoric correlations. Every time I run the
command sem(model, data, N=.), I get the following warning message:
Warning message:
In if (orthogonal) { :
  the condition has length > 1 and only the first element will be used

Below is the code that I am using for my dataset. I also tried to copy and
paste the code from the sem.pdf file using data from CNES but I still get
an error message.
Any help would be much appreciated.



> germany2009 <- read.dta("StataforR.dta")
> #attach(germany2009)
> viewData(germany2009)
> #
> hcor <- function(data) hetcor(data, std.err=F, pd=T)$correlations
> hetcor=hcor(germany2009)
> hetcor
   cdupid MERKELLIKECDULIKE MERKELPROXCDUPROX
cdupid  1.000  0.5073577  0.6070514 -0.4064925 -0.4146810
MERKELLIKE  0.5073577  1.000  0.7832340 -0.4405571 -0.4200360
CDULIKE 0.6070514  0.7832340  1.000 -0.4868895 -0.5042006
MERKELPROX -0.4064925 -0.4405571 -0.4868895  1.000  0.8789219
CDUPROX-0.4146810 -0.4200360 -0.5042006  0.8789219  1.000
> viewData(hetcor)
> cdu= ' CDULIKE ~ cdupid + CDUPROX
+   MERKELLIKE ~ cdupid + MERKELPROX
+   CDUPROX ~ ~ cdupid
+   cdupid ~ ~ MERKELPROX
+   CDUPROX ~ ~ MERKELPROX
+   MERKELLIKE ~ 1
+   CDULIKE ~1 '
> sem.cdu= sem(cdu, hetcor, N=1861, meanstructure=F,fixed.x=F)
Warning message:
In if (orthogonal) { :
  the condition has length > 1 and only the first element will be used
> sem.cdu= sem(cdu, hetcor,  meanstructure=F,fixed.x=F)
Warning message:
In if (orthogonal) { :
  the condition has length > 1 and only the first element will be used
> summary(sem.cdu)

-- 
Laura Schwirz

PhD Candidate and IRCHSS Scholar
Department of Political Science
Trinity College Dublin
Dublin 2
Republic of Ireland
Email: schwi...@tcd.ie

[[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] polycor package

2012-11-18 Thread Laura Maria Schwirz
Dear Yves

Many thanks for your quick reply, I really appreciate it!

The reason I was working with a correlation matrix is because I wanted to
calculate polychoric correlations first before submitting it to the actual
sem command. I was unsure whether R would use polychoric correlations when
indicating which of the variables are ordered. A final question on the
sample.cov=hetcor command. Does this not assume it is a sample
variance-covariance rather than a correlation matrix (as calculated using
the polycor package)?

I also tried using the command (thanks for the tip!)

sem.cdu= sem(cdu, data=germany2009, ordered=c("cdupid", "MERKELLIKE",
"CDULIKE", "MERKELPROX", "CDUPROX"))

but I always get the error result:

semcdu=sem(cdu, data=germany2009, ordered=c("cdupid", "MERKELLIKE",
"CDULIKE", "MERKELPROX", "CDUPROX"), fixed.x=F)
Error in tmp[cbind(REP$row[idx], REP$col[idx])] <- partable$free[idx] :
  NAs are not allowed in subscripted assignments

Is there anything I am missing? Obviously, I would prefer using the raw
data and use the WLSMV estimator to obtain unbiased and efficient results
so I'd rather take advantage of the full data.

Many thanks for your advice on this.

Kind regards,
Laura Schwirz



On 17 November 2012 09:56, yrosseel  wrote:

> Dear Laura,
>
> John is correct. The error is produced by the sem() function in the lavaan
> package. The reason is that you did not use proper names for the function
> arguments. The correct call should be:
>
> sem.cdu= sem(cdu, sample.cov=hetcor, sampl.nobs=1861,
> meanstructure=F,fixed.x=F)
>
> But more importantly, using a polychoric correlation as input, and using
> ML estimation will not produce correct standard errors and test statistics.
> A better approach is to use the categorical capabilities of lavaan and
> provide the full data to sem(), indicating which variables can be
> considered as 'ordered'. For example:
>
> sem.cdu= sem(cdu, data=germany2009, ordered=c("cdupid", "MERKELLIKE",
> "CDULIKE", "MERKELPROX", "CDUPROX"))
>
> Here, I assumed all variables can be considered as ordered. If some of
> them should be treated as conintuous/numeric, omit them from the ordered=
> argument.
>
> By default, lavaan will use the WLSMV estimator when ordered variables are
> involved.
>
> Yves.
>
>
>
> On 11/16/2012 10:13 PM, John Fox wrote:
>
>> Dear Laura,
>>
>> As I explained to you when you wrote to me directly, you're not
>> having trouble with the polycor package, since you have AFAICS
>> successfully computed polychoric correlation among your variables.
>> The error is produced when you call sem(), apparently in the lavaan
>> package (though you don't mention that), and you should address your
>> question to the author of that package (or use an appropriate title
>> line in your r-help posting).
>>
>> Best, John
>>
>> --**-- John Fox Sen.
>> William McMaster Prof. of Social Statistics Department of Sociology
>> McMaster University Hamilton, Ontario, Canada
>> http://socserv.mcmaster.ca/**jfox/ <http://socserv.mcmaster.ca/jfox/> On 
>> Fri, 16 Nov 2012 12:58:03 +
>> Laura Maria Schwirz  wrote:
>>
>>> I am currently working with R's polycor package and I have
>>> encountered a problem. I tried to follow the steps as outlined in
>>> the sem.pdf file where a CFA model is run using polychoric
>>> correlations. Every time I run the command sem(model, data, N=.), I
>>> get the following warning message: Warning message: In if
>>> (orthogonal) { : the condition has length > 1 and only the first
>>> element will be used
>>>
>>> Below is the code that I am using for my dataset. I also tried to
>>> copy and paste the code from the sem.pdf file using data from CNES
>>> but I still get an error message. Any help would be much
>>> appreciated.
>>>
>>>
>>>
>>>  germany2009 <- read.dta("StataforR.dta") #attach(germany2009)
>>>> viewData(germany2009) # hcor <- function(data) hetcor(data,
>>>> std.err=F, pd=T)$correlations hetcor=hcor(germany2009) hetcor
>>>>
>>> cdupid MERKELLIKECDULIKE MERKELPROXCDUPROX cdupid
>>> 1.000  0.5073577  0.6070514 -0.4064925 -0.4146810 MERKELLIKE
>>> 0.5073577  1.000  0.7832340 -0.4405571 -0.4200360 CDULIKE
>>> 0.6070514  0.7832340  1.000 -0.4868895 -0.5042006 MERKELPROX
>>> -0.4064925 -0.4405571 -0.4868895  1.000  0.8789219 CDUPROX
>

[R] Accessing matrix elements within a list

2010-06-26 Thread Maria P Petrova
Hi there, 

I cannot seem to figure out how to access the elements of a list if those 
elements are a matrix.
For example I have a the following list
 
df.list <- vector("list", 3)
and I have made each of the elements a matrix as follows

for(i in 1:3){
 assign(paste("s",i, sep=""),matrix(0, nrow = 20, ncol = 5, byrow
= FALSE, dimnames = NULL))
}

# and then insert them with a loop like this

# put matrices names in a vector
matrices<-c("s1","s2","s3") 

# insert
for(i in 1:3){
df.list[[i]] <- matrices[i]
}

My question is I cannot access the first rwo of the matrix within a list. The 
following does not work

df.list [[1]][1,]

Thanks for your help!

__
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, reproducible code.


[R] add regression equation to panel.lm

2011-02-15 Thread Maria Dulce Subida

Dear all,

I created a scatterplot matrix with the scatterplot and linear 
regression line in the upper panel, the density histogram in the 
diagonal panel and the values of the Pearson coefficient, probability 
and number of observations used, in the lower panel. Please see the 
script above.
Now I would like to add the regression equation to the upper panel. I 
thought it would be something simple, but I was not able to figure it 
out. Any ideas, please?


Thanks a lot!

Dulce



library(car)
library(psych)

panel.cor <- function(x, y, method="pearson", digits=2,...) {

points(x,y,type="n");
usr <- par("usr"); on.exit(par(usr))
par(usr = c(0, 1, 0, 1));
correl <- cor.test(x,y, method=method, use="complete.obs");
sum.row <- rowSums(cbind(x,y));
conta.n <- length(sum.row[!is.na(sum.row)]);
n=conta.n;
r=correl$estimate;
pval=correl$p.value;
color="black";
fontface=1;
if (pval<0.05) fontface=2;
txt <- format(r,digits=2)
pval <- format(pval,digits=2)
txt <- paste("r= ", txt, "\np=",pval, "\nn=", n, sep="")
text(0.5, 0.5, txt,col=color, font=fontface)
}

panel.diag<-function(x, ...)
{
usr <- par("usr"); on.exit(par(usr))
   par(usr = c(usr[1:2], 0, 1.5) )
h <- hist(x, plot = FALSE)
breaks <- h$breaks; nB <- length(breaks)
  y <- h$counts; y <- y/max(y)
rect(breaks[-nB], 0, breaks[-1], y, col="grey", ...)
   d <- density(x,na.rm=TRUE,bw="nrd",adjust=1.2)
d$y <- d$y/max(d$y)
   lines(d)
}

pairs (~ x + y + z + q, data=my_data, main = "my_data", na.action = 
"na.pass",
diag.panel=panel.diag, upper.panel=panel.lm, col.lm="grey", 
lower.panel=panel.cor,

pch=20, cex=0.5, cex.labels=1, font.labels=2, lwd=0.5)

__
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, reproducible code.


[R] add regression equation to panel.lm - package psych

2011-02-16 Thread Maria Dulce Subida

Dear all,

I created a scatterplot matrix with the scatterplot and linear
regression line in the upper panel, the density histogram in the
diagonal panel and the values of the Pearson coefficient, probability
and number of observations used, in the lower panel. Please see the
script above.
Now I would like to add the regression equation to the upper panel. I
thought it would be something simple, but I was not able to figure it
out. Any ideas, please?

Thanks a lot!

Dulce



library(car)
library(psych)

panel.cor<- function(x, y, method="pearson", digits=2,...) {

points(x,y,type="n");
usr<- par("usr"); on.exit(par(usr))
par(usr = c(0, 1, 0, 1));
correl<- cor.test(x,y, method=method, use="complete.obs");
sum.row<- rowSums(cbind(x,y));
conta.n<- length(sum.row[!is.na(sum.row)]);
n=conta.n;
r=correl$estimate;
pval=correl$p.value;
color="black";
fontface=1;
if (pval<0.05) fontface=2;
txt<- format(r,digits=2)
pval<- format(pval,digits=2)
txt<- paste("r= ", txt, "\np=",pval, "\nn=", n, sep="")
text(0.5, 0.5, txt,col=color, font=fontface)
}

panel.diag<-function(x, ...)
{
usr<- par("usr"); on.exit(par(usr))
   par(usr = c(usr[1:2], 0, 1.5) )
h<- hist(x, plot = FALSE)
breaks<- h$breaks; nB<- length(breaks)
  y<- h$counts; y<- y/max(y)
rect(breaks[-nB], 0, breaks[-1], y, col="grey", ...)
   d<- density(x,na.rm=TRUE,bw="nrd",adjust=1.2)
d$y<- d$y/max(d$y)
   lines(d)
}

pairs (~ x + y + z + q, data=my_data, main = "my_data", na.action =
"na.pass",
diag.panel=panel.diag, upper.panel=panel.lm, col.lm="grey",
lower.panel=panel.cor,
pch=20, cex=0.5, cex.labels=1, font.labels=2, lwd=0.5)

__
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, reproducible code.


[R] urgent Help needed

2011-07-19 Thread Ana-Maria Pistea
Dear Sir,
Please help me to open my rda files. It's urgent to see the content and even
if I looked for solutions i didn't find one.
When I try to load my .rda file I receive this message:

"R> load(file = "SpecPhantomExp2WaterSupp Set2.rda")

Error: bad restore file magic number (file may be corrupted) -- no data
loaded
In addition: Warning message:
file 'SpecPhantomExp2WaterSupp Set2.rda' has magic number '>>> B'
   Use of save versions prior to 2 is deprecated"

Please, could you help me to repair this error?
Yours sincerly,

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] anova for two mixture model objects

2012-08-23 Thread Maria Manuel Angélico
Hi,

I´m having problems trying to compare models obtained using the mixture model 
fitting function “mix”

 

model1<- mix(data, data.par1,dist="norm")

model2<- mix(data, data.par2,dist="norm")

 

anova(model1, model2)

 

When the number of parameters estimated for the two models is different I get 
an error message: 

“Error in anova.mix(model1, model2) : 

 binary operation on non-conformable arrays”

 

When both models have the same number of parameters estimated I get a warning 
saying that the models should be nested:

“Warning message:

In anova.mix(model1, model2) : The models are not nested”

 



I wonder if anyone can help

Thanks in advance

Maria



---- 

Maria Manuel Angélico 
IPMA, Portuguese Institute for Sea and Atmosphere
Lisboa , Portugal 
tel: ++ 351 213027068 
angel...@ipimar.pt

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] $ operator is invalid for atomic vectors

2012-04-19 Thread Ana-Maria Dobre
I have got the following statement:

*> overview.domains$sample.var <- aggregate(migr$amigo.migr,
by=list(siruta=amigo$siruta), var)[,-1]/overview.domains$n.i.*
*Error in migr$amigo.migr : $ operator is invalid for atomic vectors*


What should i do to solve this error?


Thank you.

Kind regards,
Ana Maria Dobre

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] Error on easy way for JoSAE Package

2012-05-11 Thread Ana-Maria Dobre
Dear Mr/Mrs,

I have got the the data sets in the attachement (txt).
The fact is that on applying the easy method for JoSAE package on these
data sets I got the following error:

> result <- eblup.mse.f.wrap(domain.data = d.data, lme.obj = fit.lme1)
Error in solve.default(asympt.var.covar) :
  Lapack routine dgesv: system is exactly singular


Could you please explain me how to solve this error or what kind of changes
i have to do on my data sets?

Thank you.
Kind regars,
Ana Dobre
 >head(amigo)

 siruta med migr y_m y_f ydirect mediu_um mediu_rm mediu_uf mediu_rf
1   1   1017   13   3   0 301  301000
2   1   1071   30   0   0   00000
3   1   1151   10   0   0   00000
4   1   1213   12   1   1 164  1180   460
5   1   1348   1   14   5   9   00000
6   1   1455   10   0   0   00000
  female male emig_coef c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16
1  0  301 0  0  0  0  0  0  0  0  0  0   0   0   0   0   0   0   0
2  00 0  0  0  0  0  0  0  0  0  0   0   0   0   0   0   0   0
3  00 0  0  0  0  0  0  0  0  0  0   0   0   0   0   0   0   0
4 46  11846  0  0  0  0  0  0  0  0  0   0   0   0   0   0   0   0
5  00 0  0  0  0  0  0  0  0  0  0   0   0   0   0   0   0   0
6  00 0  0  0  0  0  0  0  0  0  0   0   0   0   0   0   0   0
  c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 c33 c34 c35
1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
3   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
4   0   0   0  46   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
5   0   0   0   0   1   0   0   0   0   0   1   0   3   1   0   0   0   0   2
6   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
  c36 c37 c38 c39 c40 c41 c42 c43 c44 c45 c46 c47 c48 c49 c50 c51 c52 c53 c54
1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
3   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
4   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
5   2   0   1   0   0   1   0   0   0   0   0   0   0   0   1   0   0   0   0
6   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
  c55 c56 c57 c58 c59 c60 c61 c62 c63 c64 c65 c66 c67 c68 c69 c70 c71 c72 c73
1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
3   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
4   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
5   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
6   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
  c74 c75 c76 c77 c78 c79 c80 c81 c82 c83 c84 c85 c86 c87 c88 c89 c90 c91 c92
1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
3   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
4   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
5   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
6   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
  c93 c94 c95 c96 c97 c98 c99 c100 c101 gr_1f gr_2f gr_3f gr_4f gr_5f eduinf_f
1   0   0   0   0   0   0   000 0 0 0 0 00
2   0   0   0   0   0   0   000 0 0 0 0 00
3   0   0   0   0   0   0   000 0 0 0 0 00
4   0   0   0   0   0   0   000 046 0 0 0   46
5   0   0   0   0   0   0   000 0 110 2 07
6   0   0   0   0   0   0   000 0 0 0 0 00
  edusup_f gr_1m gr_2m gr_3m gr_4m gr_5m eduinf_m edusup_m
108580 0   136 0  3010
20 0 0 0 0 000
30 0 0 0 0 000
40 0 0   118 0 0  1180
56 1 1 3 1 042
60 0 0 0 0 000


>head(rpl)

 siruta med   pop mediu_um mediu_rm mediu_uf mediu_rf female  male  c1  c2  c3  
c4  c5  c6  c7  c8  c9 c10 c11 c12 c13 c14 c15
1   1   1017   1 65679312700344090  34409 31270 257 258 
260 286 295 259 245 284 267 307 399 412 562 570 607
2   1 

[R] superposing a group of x,y-plot points

2008-04-19 Thread Anna-Maria Tyrisevä

Hi, 

please, could somebody tell me how can I superpose a group of x,y-plot
points (using different symbols) that belong to a certain class of factor z?
Can't find a solution despite of hours of reading.

Thanks in advance,

Anna-Maria

__
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, reproducible code.


[R] save a plot from R graphics window (in Windows)

2008-01-24 Thread Giovanni Maria Marchetti
Dear R users

since R  2.6.0 when I try to save a graph from the Rgraphic device I find
that
the system becomes so slow that I'm forced to kill the process.
This usually does not happen at the beginning of the session.
The problem seems to arise when the system opens the dialog
window to choose the directory and file name.

(R version 2.6.1 under Windows XP)


Thank you all

Giovanni

-- 
Giovanni M. Marchetti
Dipartimento di Statistica, "G. Parenti", University of Florence
viale Morgagni, 59  Phone:  +39 055 4237 261
I 50134 Firenze, Italy  Fax:+39 055 4223 560

[[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
and provide commented, minimal, self-contained, reproducible code.


[R] Installing the Rstem package

2009-03-05 Thread Maria I. Tchalakova
Hello,

I am trying to install the Rstem package, but I have problems. I am
using Windows XP and the 2.8.1 version of R. I have read the "Add-on
packages" chapter of the "R Installation and Administration" manual,
and also have tried several things, which worked for other people on
the mailing list having faced the same problem
(http://tolstoy.newcastle.edu.au/R/help/06/03/22889.html).

I paste below the things, which I have tried and the results. I don't
understand what the message "installation of package 'Rstem' had
non-zero exit status" mean, which I get on my last try below. Could
anyone advise me what should I do? Thank you.

p.s. I have successfully installed the lsa package, which depends on
the Rstem package.



## First Try ##
> chooseCRANmirror()
> install.packages(c("Rstem", "lsa"))
trying URL 'http://cran.at.r-project.org/bin/windows/contrib/2.8/lsa_0.61.zip'
Content type 'application/zip' length 205671 bytes (200 Kb)
opened URL
downloaded 200 Kb

package 'lsa' successfully unpacked and MD5 sums checked

The downloaded packages are in
C:\Documents and Settings\Administrator\Local
Settings\Temp\RtmpdBelSq\downloaded_packages
updating HTML package descriptions
Warning message:
package ‘Rstem’ is not available


## Second Try 
> install.packages("Rstem", repos = "http://www.omegahat.org/R";)
Warning: unable to access index for repository
http://www.omegahat.org/R/bin/windows/contrib/2.8
Warning message:
package ‘Rstem’ is not available



## Third Try ##
> install.packages("Rstem", repos = "http://www.omegahat.org/Rstem/";)
Warning: unable to access index for repository
http://www.omegahat.org/Rstem/bin/windows/contrib/2.8
Warning message:
package ‘Rstem’ is not available


The Rstem package could be found here:
http://www.omegahat.org/Rstem/



## Fourth Try ##
> install.packages("Rstem", repos = "http://www.omegahat.org/R";, type = 
> "source")

trying URL 'http://www.omegahat.org/R/src/contrib/Rstem_0.3-1.tar.gz'
Content type 'application/x-gzip' length 606408 bytes (592 Kb)
opened URL
downloaded 592 Kb

tar (child): Cannot open archive
/cygdrive/C\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RtmpdBelSq/downloaded_packages/Rstem_0.3-1.tar.gz:
No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error exit delayed from previous errors
Error: cannot untar the package

The downloaded packages are in
C:\Documents and Settings\Administrator\Local
Settings\Temp\RtmpdBelSq\downloaded_packages
Warning message:
In install.packages("Rstem", repos = "http://www.omegahat.org/R";,  :
  installation of package 'Rstem' had non-zero exit status
##

__
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, reproducible code.


Re: [R] Installing the Rstem package

2009-03-05 Thread Maria I. Tchalakova
Hello,

thanks a lot for the replies. I've installed the binary for R-2.8.x
available at:
http://www.statistik.uni-dortmund.de/~ligges/Rstem_0.3-1.zip

However, when I try using some of the functions, such as
getStemLanguages() or wordStem(), I get:

> getStemLanguages()
Error: could not find function "getStemLanguages"

or

> words = c("sing", "singing", "singer")
> wordStem(words, language = "english")
Error: could not find function "wordStem"

Why do I get this? Haven't I installed the package correctly? I've
done this using the R Gui: "Packages" --> "Install package(s) from
local zip files ...", have chosen the .zip file, which I've downloaded
from the URL you sent me, and I got:

> utils:::menuInstallLocal()
package 'Rstem' successfully unpacked and MD5 sums checked
updating HTML package descriptions

Do I need to do something else? I receive the same results after
installing (in this way) the the binary for R-2.7.x.

Prof Brian Ripley wrote:
> b) A few are available from CRAN extras (one of the default repositories on 
> Window), and I've added Rstem.

I'm sorry, I didn't understand what you mean by "CRAN extras". I have
googled and found this page with binaries checks for Windows, but
there is no Rstem package there, and it is just a "check" (no files
which I could download):
http://cran.r-project.org/bin/windows/contrib/checkSummaryWin.html

Regards


On 3/5/09, Prof Brian Ripley  wrote:
> I don't understand the last message either: the build environment has
> problems.
>
> a) There seem to be no Windows binaries on Omegahat for R > 2.7.
>
> b) A few are available from CRAN extras (one of the default
> repositories on Window), and I've added Rstem.  So please try again
> now.
>
> On Thu, 5 Mar 2009, Maria I. Tchalakova wrote:
>
>> Hello,
>>
>> I am trying to install the Rstem package, but I have problems. I am
>> using Windows XP and the 2.8.1 version of R. I have read the "Add-on
>> packages" chapter of the "R Installation and Administration" manual,
>> and also have tried several things, which worked for other people on
>> the mailing list having faced the same problem
>> (http://tolstoy.newcastle.edu.au/R/help/06/03/22889.html).
>>
>> I paste below the things, which I have tried and the results. I don't
>> understand what the message "installation of package 'Rstem' had
>> non-zero exit status" mean, which I get on my last try below. Could
>> anyone advise me what should I do? Thank you.
>>
>> p.s. I have successfully installed the lsa package, which depends on
>> the Rstem package.
>
> Only for some restricted value of 'success'.
>
>>
>>
>> ## First Try ##
>>> chooseCRANmirror()
>>> install.packages(c("Rstem", "lsa"))
>> trying URL
>> 'http://cran.at.r-project.org/bin/windows/contrib/2.8/lsa_0.61.zip'
>> Content type 'application/zip' length 205671 bytes (200 Kb)
>> opened URL
>> downloaded 200 Kb
>>
>> package 'lsa' successfully unpacked and MD5 sums checked
>>
>> The downloaded packages are in
>>C:\Documents and Settings\Administrator\Local
>> Settings\Temp\RtmpdBelSq\downloaded_packages
>> updating HTML package descriptions
>> Warning message:
>> package ‘Rstem’ is not available
>>
>>
>> ## Second Try 
>>> install.packages("Rstem", repos = "http://www.omegahat.org/R";)
>> Warning: unable to access index for repository
>> http://www.omegahat.org/R/bin/windows/contrib/2.8
>> Warning message:
>> package ‘Rstem’ is not available
>>
>>
>>
>> ## Third Try ##
>>> install.packages("Rstem", repos = "http://www.omegahat.org/Rstem/";)
>> Warning: unable to access index for repository
>> http://www.omegahat.org/Rstem/bin/windows/contrib/2.8
>> Warning message:
>> package ‘Rstem’ is not available
>>
>>
>> The Rstem package could be found here:
>> http://www.omegahat.org/Rstem/
>>
>>
>>
>> ## Fourth Try ##
>>> install.packages("Rstem", repos = "http://www.omegahat.org/R";, type =
>>> "source")
>>
>> trying URL 'http://www.omegahat.org/R/src/contrib/Rstem_0.3-1.tar.gz'
>> Content type 'application/x-gzip' length 606408 bytes (592 Kb)
>> opened URL
>> downloaded 592 Kb
>>
>> tar (child): Cannot open archive
>> /cygdrive/C\DO

Re: [R] Installing the Rstem package

2009-03-05 Thread Maria I. Tchalakova
Hello,

yes with loading the package: library("Rstem") works! Thank you.



On 3/6/09, Rolf Turner  wrote:
>
> On 6/03/2009, at 10:29 AM, Maria I. Tchalakova wrote:
>
>> Hello,
>>
>> thanks a lot for the replies. I've installed the binary for R-2.8.x
>> available at:
>> http://www.statistik.uni-dortmund.de/~ligges/Rstem_0.3-1.zip
>>
>> However, when I try using some of the functions, such as
>> getStemLanguages() or wordStem(), I get:
>>
>>> getStemLanguages()
>> Error: could not find function "getStemLanguages"
>>
>> or
>>
>>> words = c("sing", "singing", "singer")
>>> wordStem(words, language = "english")
>> Error: could not find function "wordStem"
>>
>> Why do I get this? Haven't I installed the package correctly? I've
>> done this using the R Gui: "Packages" --> "Install package(s) from
>> local zip files ...", have chosen the .zip file, which I've downloaded
>> from the URL you sent me, and I got:
>>
>>> utils:::menuInstallLocal()
>> package 'Rstem' successfully unpacked and MD5 sums checked
>> updating HTML package descriptions
>>
>> Do I need to do something else? I receive the same results after
>> installing (in this way) the the binary for R-2.7.x.
>
> It sounds to me like you haven't ***loaded*** the package.
>
> See ?library.
>
>   cheers,
>
>   Rolf Turner
>
> ##
> Attention:
> This e-mail message is privileged and confidential. If you are not the
> intended recipient please delete the message and notify the sender.
> Any views or opinions presented are solely those of the author.
>
> This e-mail has been scanned and cleared by MailMarshal
> www.marshalsoftware.com
> ##
>

__
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, reproducible code.


[R] installing and loading packages

2009-03-20 Thread Maria I. Tchalakova
Hello,

is it possible to make so that once I have installed and loaded the
necessary packages in R, I don't need to install and load them for a
new session in R?
Up to now I install packages, for example, like this:

install.packages("package_name")

and then load them like this:

library("package_name")

When I exit R and then run it again, I need to install and load the
packages using again the above commands, so that I can use them. (I
save the workspace before I exit, but this doesn't help).
Thank you.

__
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, reproducible code.


[R] error MANOVA in R

2015-03-30 Thread Gian Maria Niccolò Benucci
Dear R-usrs,

I am trying to perform a MANOVA on a data frame with 31 columns about soil
parameters and 1 column containing the explanatory variable (Fraction) that
have three levels.
my code is the following:

datam <- read.table("data_manova2.csv", header=T, sep=",")
names(datam)

manova_fraction2 <- manova(cbind(pH, AWC, WEOC, WEN, C.mic, CO2.C, Ca, Mg,
K, Na, sol.exch.Fe, easily.reducible.Fe, amourphou.Fe.oxide...Fe.OM,
crystalline.Fe.oxides, TN, TOC, NH4.N, NO3.N, N.org, organic.P, avaiable.P,
Total.PLFA, Tot.Bat, Gram., Gram..1, Funghi, AMF, protozoa, actinomiceti,
non.specifici) ~ as.factor(Fraction), data= datam)

summary(manova_fraction2)

when I did the summary I got this error

> summary(manova_fraction2)
Error in summary.manova(manova_fraction2) : residuals have rank 18 < 30

​Is this error possibly due to high correlation between my variables?

Many thanks in advance,


-- 
Gian

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

  1   2   >