[R] regression on data subsets in datafile

2011-09-12 Thread marcel
I have data of the form

tC <- textConnection("
Subject Dateparameter1
bob 3/2/99  10
bob 4/2/99  10
bob 5/5/99  10
bob 6/27/99 NA
bob 8/35/01 10
bob 3/2/02  10
steve   1/2/99  4
steve   2/2/00  7
steve   3/2/01  10
steve   4/2/02  NA
steve   5/2/03  16
kevin   6/5/04  24
")
data <- read.table(header=TRUE, tC)
close.connection(tC)
rm(tC)

I am trying to calculate rate of change of parameter1 in units/day for each
person. I think I need something like:
"lapply(split(mydata, mydata$ppt), function(x) lm(parameter1 ~ day,
data=x))"

I am not sure how to handle the dates in order to have the first day for
each person be time = 0, and the remaining dates to be handled as days since
time 0. Also, is there a way to add the resulting slopes to the data set as
a new column? 

Thanks,
Marcel 

--
View this message in context: 
http://r.789695.n4.nabble.com/regression-on-data-subsets-in-datafile-tp3806743p3806743.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] Stacked bar plot of frequency vs time

2011-07-11 Thread marcel
Hi All,
New to R, but committed. I looked in a number of places but can't figure out
my current problem. I have date of the type:

Time Type1  Type2  Type3
1.50   .25 .25
4.55   .25 .20
5.65   .20 .15
etc

which describe the frequency of types 1, 2 and 3 (adding up to 100%) over
time. I would like to create a stacked bar chart showing these frequencies,
each bar of height = 1, subsections of bars proportional to the frequency,
and each bar located at the correct X (time) position. One difficulty is
that the desired spacing of bar locations on the x-axis is irregular. Is
this possible in R?

Many thanks,
Marcel

--
View this message in context: 
http://r.789695.n4.nabble.com/Stacked-bar-plot-of-frequency-vs-time-tp3659715p3659715.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] Plot command overwrites existing plot in multiple figure plot

2011-07-11 Thread marcel
Hi all,
I have a figure with 5 separate graphs in a stacked layout. While most of my
plots drop into their appointed spots nicely, my last plot, using lattice
and the plot(object) command insists on wiping out my current plot window
altogether, and just plotting the last figure by itself. The relevant part
of my code is of the form:

nf <-
layout(matrix(c(1,1,1,1,0,0,2,2,2,2,0,0,3,3,3,3,0,0,4,4,4,4,0,0,5,5,5,5,0,0),5,6,
byrow=TRUE), respect=FALSE)

#first plot, plots well
attach(data1)
par(mar=c(0.2,4.5,0.2,0.5))
plot(var1, var2, frame=T, etc..) 
detach(data1)

#second plot, plots fine
attach(data2)
par(mar=c(0.2,4.5,0.2,0.5))
plot(var3, var4, frame=T, etc...) 
detach(data1)

require(lattice)
tmpdf <- data.frame(Mydata)
tmpdf   #data show up fine
barchart(values ~ Time, group=ind, data=tmpdf, stack=TRUE, horizontal=FALSE)
xyplot(values ~ Time, group=ind, data=tmpdf, stack=TRUE, horizontal=FALSE,
panel=panel.barchart, ylim=c(-0.05,1.05), xlim=c(0,6))

# Problem here. This command will wipe out my existing window (prints
briefly and is then quickly replaced by the plot below
print(xyplot(values ~ Time, group=ind, data=tmpdf, stack=TRUE,
horizontal=FALSE, panel=panel.barchart, ylim=c(-0.05,1.05), xlim=c(0,6)))

Is there any way around this problem?

Marcel


--
View this message in context: 
http://r.789695.n4.nabble.com/Plot-command-overwrites-existing-plot-in-multiple-figure-plot-tp3661245p3661245.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.


Re: [R] Plot command overwrites existing plot in multiple figure plot

2011-07-13 Thread marcel
This problem has been an opportunity for me to learn about issues mixing base
graphics with lattice plots. From the many pdfs and blogs and other things I
have found, it seems that I have two options: 1) insert a viewport of my bar
graph into a basic environment; or 2) do all of my plots in lattice. 

I have tried each and have encountered difficulties. I think the simplest
approach should be to add a lattice bar graph to the rest of my plot,
because all of the plots are already made. Unfortunately, despite the many
references to these issues, I was not able to find an example of this being
done. I think it should involve 

I have most of the parts working, but am not sure how to put the last pieces
together: 


nf <-
layout(matrix(c(1,1,1,1,0,0,2,2,2,2,0,0,3,3,3,3,0,0,4,4,4,4,0,0,5,5,5,5,0,0),5,6,
byrow=TRUE), respect=FALSE)
 
# first my regular plots
attach(mydatafile1)
par(mar=c(0.2,4.5,0.2,0.5))
plot(xvalue, yvalue, frame=T)
detach(mydatafile1)

attach(mydatafile2)
par(mar=c(0.2,4.5,0.2,0.5))
plot(xvalue, yvalue, frame=T)
detach(mydatafile2)

# now the bar plot in lattice, which I know will plot fine in its own window
require(lattice)
tmpdf <- data.frame(Time=rep(tmp$Time, 3), stack(tmp[,2:4]))
barchart(values ~ Time, group=ind, data=tmpdf, stack=TRUE, horizontal=FALSE)
plot5 <- xyplot(values ~ Time, group=ind, data=tmpdf, stack=TRUE,
horizontal=FALSE, panel=panel.barchart)

# here is the issue, how to get this into basic. I think I need a
pushViewport command of some kind
lviewport(x=unit(1, "npc") - unit(1, "inches"), y=0.5, width=0.2,
height=0.5, just=c("right", "centre")))
print(plot3, position=c(0.01, 0, 1, 0.5))

Any thoughts about how to put the last pieces together would be very much
appreciated. 

Marcel

--
View this message in context: 
http://r.789695.n4.nabble.com/Plot-command-overwrites-existing-plot-in-multiple-figure-plot-tp3661245p3665545.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.


Re: [R] Stacked bar plot of frequency vs time

2011-07-15 Thread marcel
Thank you for the solutions! 

I have the first one working and it does exactly what I am looking for.
Unfortunately I have to put the plot in a common figure alongside other
plots made in the basic environment (challenging!). With the second method,
I was unable to make the stacked bars locate to the appropriate positions
along the X axis (ie the appropriate time), which, though unconventional is
required for my figure. So I am still looking for a complete solution in the
basic plotting environment. 

I have boiled my problem down to this minimal example: 

# Made-up data
tC <- textConnection("
Time Type1 Type2 Type3
1.3 .50 .25 .25
4.5 .55 .25 .20
5.2 .65 .20 .15
")

data1 <- read.table(header=TRUE, tC)
data2 <- data.frame(Time=rep(data1$Time, 3), stack(data1[,2:4]))
close.connection(tC)

# PLOT1 Scatterplot
attach(data1)
par(mar=c(1,1,1,1))
plot(Time, Type1, frame=T, ylab="Divergence",
col=rgb(0,100,0,50,maxColorValue=255), main="plot 1", xlim= c(0,6), ylim=
c(0, 1), axes=FALSE, xlab=" ")
detach(data1)

# PLOT2 barplot
require(lattice)
attach(data2)
barchart(values ~ Time, group=ind, data=data2, stack=TRUE, horizontal=FALSE,
main="not there yet")
plot2 <- xyplot(values ~ Time, group=ind, data=data2, stack=TRUE,
horizontal=FALSE, panel=panel.barchart, ylim=c(-0.05,1.05), xlim=c(0,6),
main="Plot 2- how can I plot below plot1?")
print(plot2)
detach(data2)

The only thing left is to get both plots to be vertically aligned, one above
the other on the same figure. Is this possible? Thanks for all of your
thoughts.

Marcel

Marcel

--
View this message in context: 
http://r.789695.n4.nabble.com/Stacked-bar-plot-of-frequency-vs-time-tp3659715p3669311.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] Lattice: place ticks only on y-axis

2011-07-21 Thread marcel
I am using lattice for a bar plot, having a little trouble removing ticks,
tick labels from x-axis, but keeping them on the y-axis. I looked around
quite a bit (http://tolstoy.newcastle.edu.au/R/e7/help/09/06/1733.html, help
pages, etc), tried variations of "scales = list(alternating = c(0,0)",
"scales = list(alternating = c(0,0), tck = c(0,0))" and others, couldn't
quite get it. 

#My code:
tC <- textConnection("
Time Type1 Type2 Type3
1.3 .50 .25 .25
4.5 .55 .25 .20
5.2 .65 .20 .15
")

data1 <- read.table(header=TRUE, tC)
data2 <- data.frame(Time=rep(data1$Time, 3), stack(data1[,2:4]))
close.connection(tC)
rm(tC)

require(lattice)
plot1<-xyplot(values ~ Time, scales = list(alternating = c(0,0), tck =
c(0,0)), group=ind, data=data2, stack=TRUE, horizontal=FALSE,
panel=panel.barchart, box.width=0.1,  axes=FALSE, ylim=c(-0.05,1.05),
xlim=c(0,6), main="Plot1")
print(plot1, position=c(0,0,1,.6))
 

--
View this message in context: 
http://r.789695.n4.nabble.com/Lattice-place-ticks-only-on-y-axis-tp3684094p3684094.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.


Re: [R] Lattice: place ticks only on y-axis

2011-07-21 Thread marcel
Works perfectly, thank you.

--
View this message in context: 
http://r.789695.n4.nabble.com/Lattice-place-ticks-only-on-y-axis-tp3684094p3685625.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.


Re: [R] Lattice: place ticks only on y-axis

2011-07-22 Thread marcel
I notice that with this solution there are still y-axis tick marks on both
sides of the plot. Is there a way to remove the ones on the right side?

--
View this message in context: 
http://r.789695.n4.nabble.com/Lattice-place-ticks-only-on-y-axis-tp3684094p3686638.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] Lattice: distance of Y-axis label from plot

2011-07-22 Thread marcel
Basic question: I looked around quite a bit, still having a little trouble
manipulating the distance between the Y-axis label and the plot. In this
case, I would like to move the Y axis title closer to the plot. 


# Data
tC <- textConnection("
Time Type1 Type2 Type3
1.3 .50 .10 .40
4.5 .45 .20 .35
5.2 .40 .30 .30
")

data1 <- read.table(header=TRUE, tC)
data2 <- data.frame(Time=rep(data1$Time, 3), stack(data1[,2:4]))
close.connection(tC)
rm(tC)

#PLOT 1 lattice bar plot
require(lattice)
plot1<-xyplot(values ~ Time, ylab=list(label="Move this title closer to
plot", fontsize=9), scales=list(y=list(relation="free", rot=0, cex=0.7), x =
list(draw = FALSE)), group=ind, data=data2, stack=TRUE, horizontal=FALSE,
panel=panel.barchart, box.width=0.1, axes=FALSE, ylim=c(0.03,0.98),
xlim=c(-0.2, 6.25), main="", xlab="")

#position X1,Y1, X2,Y2
print(plot1, position=c(-0.018,0.221,0.741,0.466))


--
View this message in context: 
http://r.789695.n4.nabble.com/Lattice-distance-of-Y-axis-label-from-plot-tp3686855p3686855.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.


Re: [R] Lattice: place ticks only on y-axis

2011-07-23 Thread marcel
Working! Many thanks, good solutions


--
View this message in context: 
http://r.789695.n4.nabble.com/Lattice-place-ticks-only-on-y-axis-tp3684094p3688167.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.


Re: [R] Lattice: distance of Y-axis label from plot

2011-07-23 Thread marcel
 Got it working using "layout.widths = list(ylab.axis.padding = 0.5)))" and
adjusting the print position in "print(plot1,
position=c(-0.018,0.221,0.741,0.466))". Thx



--
View this message in context: 
http://r.789695.n4.nabble.com/Lattice-distance-of-Y-axis-label-from-plot-tp3686855p3688172.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] Lattice: distance of tick labels from axis line

2011-07-25 Thread marcel
Hi, I am doing fine editing on a lattice plot, now have the Y-axis title in
the correct position, but the tick labels are too far from the axis line. I
looked at the help documentation but could not find how to change this. This
seems to be easy to do in basic plots with "at=c(value1, value2, value3)" .
Is there some equivalent in lattice? Thanks. 

--
View this message in context: 
http://r.789695.n4.nabble.com/Lattice-distance-of-tick-labels-from-axis-line-tp3693014p3693014.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.


Re: [R] Lattice: distance of tick labels from axis line

2011-07-26 Thread marcel
Thank you, this works well - overall, I now have pretty good control over the
appearance of the L-hand side of the plot and relative distance between axis
line, ticks, tick labels and axis title by adjusting pad1, pad2 and the plot
position in the print statement. I am sure it is not the best code, but I
will throw in the relevant lines in case anyone else has encountered this
problem.  

par.settings = list(layout.widths = list(ylab.axis.padding = 0.1),
axis.components=list(left=list(pad1=0.2, pad2=1.8)))
print(plot2, position=c(-0.0068,0.221,0.741,0.466))

--
View this message in context: 
http://r.789695.n4.nabble.com/Lattice-distance-of-tick-labels-from-axis-line-tp3693014p3696157.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] Lattice: choice of symbol and symbol position in legend

2011-07-26 Thread marcel
I am making final adjustments to a multi-plot figure using basic and lattice.
In the lattice plot, I would like to include a legend that matches the
format of the legends in the other plots, which consist of appropriately
colored squares (pch 22) followed by text. In lattice, I was able to get a
legend using 

auto.key = list(x = .6, y = .6, corner = c(0, 0), pch=22)

but my request for pch=22 was ignored, the colors did not seem to match the
bars exactly, and the positioning was 'text' followed by 'symbol' instead of
the other way around. I looked through the help sections but did not find
any detailed documentation on this. Can these be adjusted? Many thanks.

--
View this message in context: 
http://r.789695.n4.nabble.com/Lattice-choice-of-symbol-and-symbol-position-in-legend-tp3696182p3696182.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.


Re: [R] Lattice: choice of symbol and symbol position in legend

2011-07-29 Thread marcel
This solution worked well, and the key section under ?xyplot was very helpful
in adjusting lots of details in the key, including position and even the
distance between text and key symbols, using "between". One thing I didn't
see described very well was how to toggle from a transparent key symbol to
one with an appropriate fill color. 

--
View this message in context: 
http://r.789695.n4.nabble.com/Lattice-choice-of-symbol-and-symbol-position-in-legend-tp3696182p3704790.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] Plot Frame color and linewidth

2011-07-31 Thread marcel
I have a figure with a lattice plot and a basic plot. Is there a way to
select the color and line width of the surrounding boxes?

# Data
tC <- textConnection("
Time Type1 Type2 Type3
1.3 .50 .10 .40
4.5 .45 .20 .35
5.2 .40 .30 .30
")

data1 <- read.table(header=TRUE, tC)
data2 <- data.frame(Time=rep(data1$Time, 3), stack(data1[,2:4]))
close.connection(tC)
rm(tC)


#My lattice plot
require(lattice)
plot1<-xyplot(values ~ Time, par.settings = list(layout.widths =
list(ylab.axis.padding = 0)), ylab=list(label="Y Label", fontsize=9),
scales=list(y=list(relation="free", rot=0, cex=0.7), x = list(draw =
FALSE)), group=ind, data=data2, stack=TRUE, horizontal=FALSE,
panel=panel.barchart, box.width=0.1, axes=FALSE, ylim=c(0.03,0.98),
xlim=c(-0.2, 6.25), main="Lattice Plot", xlab="")
plot(0.1,0.1, axes=FALSE, ylab="", xlab="", pch = "")  # dummy plot to reset
basic plot environment
print(plot1, position=c(-0.0068,0.221,0.741,0.466))

#My basic plot
par(new=TRUE, mfrow = c(4, 2), fig=c(0,1,0,1), mar=c(42.9, 4, 1.14, 15))
plot(data1$Time, data1$Type1, frame=T, main="Basic Plot", ylab="Y Label",
xlab="", col=2, xlim= c(0,6), ylim= c(0, 1), axes=FALSE)
axis(2, at=c(0.25, 0.5, 0.74), las=1)

--
View this message in context: 
http://r.789695.n4.nabble.com/Plot-Frame-color-and-linewidth-tp3708858p3708858.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.


Re: [R] experimenting (like Weka Experimenter)

2011-10-05 Thread Marcel.
Hello,

i think you are speaking of a general workflow environment which can execute
R methods and arrange
different statistical methods in a flow (graph).

Here is a list of links of such (OpenSource) programms.

*Knime:*

http://www.knime.org/ http://www.knime.org/ 

*RapidMiner*

http://rapid-i.com/content/view/181/190/
http://rapid-i.com/content/view/181/190/ 

*Red-R:*

http://www.red-r.org/ http://www.red-r.org/ 


*R AnalyticFlow:*

http://www.ef-prime.com/products/ranalyticflow_en/
http://www.ef-prime.com/products/ranalyticflow_en/ 

There are also many others available (using R) but in another context (GIS,
Scientific Modelling etc.).


I hope this information helps.



--
View this message in context: 
http://r.789695.n4.nabble.com/experimenting-like-Weka-Experimenter-tp3873363p3873741.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.


Re: [R] HOW TO PASS MY JAVA ARGUMENT INTO RSCRIPT FILE

2011-10-10 Thread Marcel.
Hello,

use the rJava library to execute R code from Java or transfer values from
Java to R:

http://www.rforge.net/rJava/ http://www.rforge.net/rJava/ 





--
View this message in context: 
http://r.789695.n4.nabble.com/HOW-TO-PASS-MY-JAVA-ARGUMENT-INTO-RSCRIPT-FILE-tp3889327p3889457.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] Output of the probemod package

2015-07-13 Thread Marcel Meyer
Hello,

I am trying to follow up a significant moderation effect in my data, using the 
pick-a-point (pap) and Johnson-Neyman (J-N) techniques. I have found the 
probemod package for this, which is very useful. Working with it over the last 
few weeks, 3 minor queries about the output have come up and I would be 
grateful for any advice in this respect. Specifically:

 (1) I found that the J-N output always provides me with the exact range of my 
moderator. I know that this is the default setting, but what I am a bit puzzled 
about is that it still gives me the output for the entire range, even when I 
specify a smaller range manually using the mrange argument (for an example, see 
my script below). Have I made any mistake here? Do others have the same 
problem? 

(2) In my case the data ranges from 8 to 15, but the package displays numbers 
1-8 in the J-N output instead. I notice that 1-8 is exactly the difference 
between 8-15, so perhaps 1 = 8, 2 = 9, 3 = 10 and so on, in which case I can 
live with that ... That said, such a convention will get a bit more confusing 
when the moderator has a large number of values, say of range 200-1000. Is 
there any way such that the actual values of the moderator can be displayed in 
the output instead (note: the mrange argument works fine for the plot functions 
of this package)?

(3) What I am also a bit confused about is that, for my data, the J-N technique 
yields p-values of around .05 at scores 6 and 7, which presumably represent 
values 13 and 14 of the moderator. Using the pap approach, I obtain a p-value < 
.02 at the moderator value of 13.48. How can this be that these two approaches 
reveal such different outcomes for very similar values (i.e. 13.48 versus 13 or 
14)? Perhaps there is something I am not doing right here or have 
misunderstood, so I would appreciate any pointers. 

For ease of replicability, I provide my R code along with the data (see end of 
message) in the following:



# create data frame

mod1<-data.frame(fp, m, dm) 



#Range of moderator

range(mod1$m)



# full interaction model

m1<-lm(dm~fp*m, data=mod1) 





# call probemod package

library(probemod)

#Probemod:J-N
jnresults <- jn(m1, dv='dm', iv='fp', mod='m', mrange=10:15)

plot(jnresults)

jnresults



#Probemod: pick-a-point

ppres<-pickapoint(m1, dv='dm', iv='fp', mod='m')

plot(ppres)


ppres



#Full data:

m<-c(11, 14, 11, 12, 11, 12,  9, 12, 12,  9, 12,  8, 11, 12, 10,  9, 13, 13, 
13, 12,  8, 11, 13, 

  10, 12, 12, 10, 11, 11, 15, 11, 11, 13, 10, 10, 15, 14, 12, 14, 13, 14, 
15, 14, 10, 13,  9, 15,

  13, 15, 12, 12, 14, 10, 12, 14, 10, 12, 10, 14,  9,  9, 11, 11, 13)

fp<-c(5,  6,  9,  7,  8,  8, 9,  3,  3,  7,  3,  6,  9,  3,  8,  5,  4, 6,  2,  
6,  6,  5,  3,  5,  7,

  8,  3,  3,  4,  3,  7,  7, 5,  4, 10,  9,  2,  9,  2,  2,  4,  3,  3,  3, 
 8,  5,  4,  6,  9,  4,

  4,  4,  5,  5,  6,  4,  4,  3,  3,  8,  6,  6,  8,  6)

dm<-c(798.5027, 773.7591, 816.7397, 867.3680, 827.8940, 824.8648, 810.3585, 
832.5348, 773.7681, 792.2763, 

  NA, 884.4126, 866.2052, 862.0126, 851.3000, 812.8300, 778.7394, 781.0571, 
798.9329, 806.9844, 

  831.4983, 814.9005, 836.8078, 823.0125, 763.5780, 780.9182, NA, 842.2906, 
788.2910, 835.8092, 

  768.4258, 734.9783, 855.5227, 833.1630, 817.5763, NA, 802.0592, 758.7745, 
846.8749, 791.8602, NA,

  NA, 869.1863, 766.5122, 834.5878, 882.9315, 917.4202, 804.2642, 748.3454, 
800.6837, 790.6344, 

  758.0473, NA, NA, 814.9149, 785.4883, NA, 778.5333, 865.5467, 820.8561, 
779.8348, 813.4988,


  784.0798, 781.3917)



Any comments would be much appreciated.

Best,

Marcel



[[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] R squared change value for a moderation effect

2015-07-13 Thread Marcel Meyer
Hello,

I want to test a regression model with neuroticism as focal predictor, 
agreeableness as moderator and RT variability as dependent measure (covariates: 
attentional control and mean RT). Previously, I have used the modprobe macro in 
SPSS by Andrew Hayes for this (for full reference see end of message). I am in 
the process of transitioning to R, however, and would like to learn how to run 
a similar routine there. I have set up my regression model as follows:

m3<-lm(data=stp2_sub2, 
all_SD~Neuroticism*Agreeableness+Attentional.Control+all_RT, na.action=na.omit) 
# full interaction model
m33<-lm(data=stp2_sub2, 
all_SD~Neuroticism+Agreeableness+Attentional.Control+all_RT, na.action=na.omit) 
# reduced model

I know that I can obtain F-change and p-change, using:

anova(m3, m33) # provides F-change and p-change

What I still don’t know yet is how to obtain the R squared change value, which 
gives me the effect size of the interaction effect. Any advice on this would be 
much appreciated.

Best,
Marcel

Reference:
Hayes, A. F., & Matthes, J. (2009). Computational procedures for probing 
interactions in OLS and logistic regression: SPSS and SAS implementations. 
Behavior Research Methods, 41(3), 924–36. doi:10.3758/BRM.41.3.924
[[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] Avoid R shell process echoes of piped inputs from a different programming language on Linux

2015-01-14 Thread marcel Austenfeld

Dear R developers,
 
i have rather a developer question.
 
>From an external application (different programming language)  i contact R 
>through pipes (process pipes -> exec).
 
On Linux i use the R (bash) script to start the R process which will be 
available in a custom shell.
 
If i pipe a command to R i have the problem that the command is echoed in my 
shell connection which i would like to avoid.
 
A R command is written in the output stream and the problem is that it is 
rewritten again in the input stream (which is output of the shell).
 
If i start the bash shell independant from the R process i got the same results 
if i pipe commands to the output.
 
If i start a Bourne-Shell independant from the R process the command is not 
echoed in the input stream.
 
So maybe it is possible that R can be started without echoing the commands of 
the output stream of the process under the Linux envrironment?
 
On Windows for example echoing (with Rterm) is not a problem.
 
Thanks in advance for any suggestion or help.

__
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] Set Conditional Breakpoint with setBreakpoint Function

2014-07-25 Thread marcel Austenfeld

   Hello,
   i'm searching for a way to realize a conditional breakpoint.
   setBreakpoint is a simple wrapper for the trace function. What i wan't to do
   is similar to the trace function
   described here:
   [1]http://www.stats.uwo.ca/faculty/murdoch/software/debuggingR/debug.shtml
   "> trace(fun, quote(if (x > 10) browser()))"
   How can i do this with the setBreakpoint function or are there any other
   alternatives to realize a conditional breakpoint?
   I use the setBreakpoint function in combination with findLineNum for a
   simple R debugging GUI.
   Thank in advance for any help

   Marcel

References

   1. http://www.stats.uwo.ca/faculty/murdoch/software/debuggingR/debug.shtml
__
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] Set Conditional Breakpoint with setBreakpoint Function

2014-07-25 Thread marcel Austenfeld

   Thank you very much. Exactly the information i needed. I always tried
   "quote(if (x > 10) browser())"
   and not
   "tracer=quote(if (x > 10) browser())"
   as the argument.

   Now it works.
__
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] Event after a package is loaded

2014-10-09 Thread marcel Austenfeld
Hello,

i would like to call a self defined R function after a package (not a specific 
one - library (anyAvailablePackage)) has been loaded into the R environment.
I there a general method available in R which can be used for that?

Any help is appreciated.
 

__
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] Event after a package is loaded

2014-10-09 Thread marcel Austenfeld
Thank you for the fast reply!

Best regards

Marcel
 

Gesendet: Donnerstag, 09. Oktober 2014 um 13:54 Uhr
Von: "Frederic Ntirenganya" 
An: "Duncan Murdoch" 
Cc: "marcel Austenfeld" , r-help@r-project.org
Betreff: Re: [R] Event after a package is loaded

I don't think the is an appropriate option for that.
 
On Thu, Oct 9, 2014 at 2:32 PM, Duncan Murdoch  
wrote:On 09/10/2014, 6:53 AM, marcel Austenfeld wrote:
> Hello,
>
> i would like to call a self defined R function after a package (not a 
> specific one - library (anyAvailablePackage)) has been loaded into the R 
> environment.
> I there a general method available in R which can be used for that?

No, I don't think so.  ?setHook defines user hooks, but they are set
separately by package, not generally.  You could change the
loadNamespace function if you want, but it won't work for other users.

Duncan Murdoch

__
R-help@r-project.org[R-help@r-project.org] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help[https://stat.ethz.ch/mailman/listinfo/r-help]
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html[http://www.R-project.org/posting-guide.html]
and provide commented, minimal, self-contained, reproducible code.


--

Frederic Ntirenganya
Maseno University,
Kenya.
Mobile:(+254)718492836
Email: fr...@aims.ac.za[fr...@aims.ac.za]
https://sites.google.com/a/aims.ac.za/fredo/

__
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] Formatting numerical output

2010-04-24 Thread MARCEL CURLIN
Hello,
I am new to R and am having difficulty formatting numerical output from a 
regression analysis. My code iteratively performs linear regression on a 
dataset while excluding certain data ranges. 

My code:
rm(list = ls(all = TRUE))
sink("outfile")
dat <- read.table("testdat", sep="\t", header=TRUE)
int = 0.2

for (x in c(0:20)) { 
subdat <- subset(dat, time <= int * x | time > (int*x) + int)   
#excludes range of time data between int * x and (int*x) + int
lm.subdat <- lm(length~time, subdat)
#regression
rs.subdat <- summary(lm.subdat)$r.squared   
#getting R-squared information
txt1 <- ("Excluded range: Time")
#creating components of output message
txt2 <- ("R^2 =")   
#creating components of output message
lowend <- (int*x)
highend <- (int*x + int)
output <- c(txt1, lowend, highend, txt2, rs.subdat)
print.noquote(output, sep="\t")
}
sink()

Currently my output looks like:
[1] Excluded range: Time 00.2 
[4] R^2 =0.111526872884505   
[1] Excluded range: Time 0.2  0.4 
[4] R^2 =0.0706332920267015  
[1] Excluded range: Time 0.4  0.6 
[4] R^2 =0.0691466100802879

I would like the output format to look like:
Excluded range: Time 1.0 - 1.2R^2 = 0.45  
Excluded range: Time 1.2 - 1.4R^2 = 0.5
etc.

I would like to 
1. get time and R^2 data on the same line
2. control (reduce) the number of digits reported for R^2
3. reduce the large number of empty spaces between "R^2' and value.

I searched a lot but could not find much on this. Any help on these specifics 
or general comments on formatting numerical output greatly appreciated. 

thanks,

Marcel

__
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] Call to R.exe in a Script fails since the upgrade from R 3.6.1 to R 4.0.2

2020-10-16 Thread Marcel Baumgartner


Dear R Community,  
  
I call R from within a software called “IDEA” 
([www.casewareanalytics.com](http://www.casewareanalytics.com)). This language 
uses its own scripting language, but it is very similar to Visual Basic. The 
basic call is as shown below:  


R_Command is a string of the form (the Chr(34) creates a double quote):
In my file “script.R”, I then start everything by:
This has worked perfectly up to R 3.6.1. But since I migrated to R 4.0.2, this 
command does not create the “log.txt” anymore. The script runs, it finds the 
arguments in the file “nga_config.R”, generates the output data, but then does 
not write the log.txt. However, when I run this R_command on the command line 
in Windows, all works fine: the log.txt is created. So the syntax is correct.
In the R windows FAQ, i see this:  
  
### 2.12 Can I use `R CMD BATCH`?  


Yes: use `R CMD BATCH --help` or `?BATCH` for full details.  


You can also set up a batch file using `Rterm.exe`. A sample batch file might 
contain (as one line)  



I tried this, but I have the same issue: the output file ("log.txt") is not 
crated. Also, choosing R.exe and Rterm.exe has no impact.  
  
Do you know whether something has changed in R 4.* that could cause this issue? 
 
  
Thanks for your help. Happy to do a Skype/Teams/Zoom session anytime!  
  
Best regards  
  
Marcel Baumgartner  
  


[[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] Error when calling R from Python

2021-01-25 Thread Marcel Baumgartner
Dear all,

my colleague posted our issue on stackoverflow:

Calling R script from Python does not save log file in version 4 -
Stack Overflow
[https://stackoverflow.com/questions/65887485/calling-r-script-from-python-does-not-save-log-file-in-version-4]

It is about this kind of call to R:

R.exe -f code.R --args "~/file.txt" 1> "~/log.txt" 2>&1".

The issue is that the log.txt file is not created when running R
4.x.x. The same code works perfectly fine with R 3.6.x. 

Any idea what's going wrong as of version 4? Regards Marcel 



[[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] Error when calling (R 4.0.x on Windows) from Python

2021-01-29 Thread Marcel Baumgartner
Dear Bill, Duncan and Martin,

thanks for your investigation. Can you clarify on next steps? Is this
now an official bug, or have you found a workaround? For your
information: the issue showed up the first time when I called R 4.0.2
from within a software called "IDEA" (from Caseware Analytics), using
their scripting language (similar to Visual Basic). With my colleague
we then simply reproduce the error calling R from Python, so that we
could share it more easily. When we run this command directly on the
CMD in Windows, all works fine. The issue only happens when R is
called within another software.

Best regards

Marcel

Le 2021-01-27T23:14:36.000+01:00, Bill Dunlap
 a écrit :

> I tried the following change, that adds quotes if the argument does
> 
> not include ">".
> 
> Index: front-ends/rcmdfn.c
> 
> ===
> 
> --- front-ends/rcmdfn.c (revision 79883)
> 
> +++ front-ends/rcmdfn.c (working copy)
> 
> @@ -173,9 +173,13 @@
> 
> fprintf(stderr, "command line too long\n");
> 
> return(27);
> 
> }
> 
> -   strcat(cmd, "\"");
> 
> +   if (!strchr(argv[i], '>')) {
> 
> +strcat(cmd, "\"");
> 
> +}
> 
> strcat(cmd, argv[i]);
> 
> -   strcat(cmd, "\"");
> 
> +   if (!strchr(argv[i], '>')) {
> 
> +   strcat(cmd, "\"");
> 
> +}
> 
> }
> 
> /* the outermost double quotes are needed for cmd.exe */
> 
> strcat(cmd, "\"");
> 
> It lets the python example work.  I am not sure that quoting all the
> 
> arguments buys you much, as shQuote() is still needed for arguments
> 
> that include spaces.  E.g.,  with 3.6.3, 4.0.3, and my development
> 
> build with the above patch we get
> 
>>  stopifnot(dir.create(dirname <- file.path(tempfile(), "A SPACE"),
>>  recursive=TRUE))
>>  
>>   logname <- file.path(dirname, "log.txt")
>>  
>>   unlink(logname)
>>  
>>   system(paste( "C:\\R\\R-3.6.3\\bin\\R.exe --quiet --vanilla -e
>>  \"commandArgs()\" 1>", logname))
> 
>  ARGUMENT 'SPACE/log.txt' __ignored__
> 
> [1] 0
> 
>>  tryCatch(readLines(logname), error=function(e)conditionMessage(e))
> 
>  [1] "cannot open the connection"
> 
> Warning message:
> 
> In file(con, "r") :
> 
>  cannot open file
> 
> 'C:\Users\willi\AppData\Local\Temp\RtmpM5tsC7\file1a1068734a49/A
> 
> SPACE/log.txt': No such file or directory
> 
>>  system(paste( "C:\\R\\R-4.0.3\\bin\\R.exe --quiet --vanilla -e
>>  \"commandArgs()\" 1>", logname))
>>  
>>   commandArgs()
> 
>  [1] "C:\\R\\R-40~1.3/bin/x64/Rterm.exe"
> 
> [2] "--quiet"
> 
> [3] "--vanilla"
> 
> [4] "-e"
> 
> [5] "commandArgs()"
> 
> [6] "1>"
> 
> [7]
> "C:\\Users\\willi\\AppData\\Local\\Temp\\RtmpM5tsC7\\file1a1068734a49/A"
> 
> [8] "SPACE/log.txt"
> 
>>  
> 
>  [1] 0
> 
>>  tryCatch(readLines(logname), error=function(e)conditionMessage(e))
> 
>  [1] "cannot open the connection"
> 
> Warning message:
> 
> In file(con, "r") :
> 
>  cannot open file
> 
> 'C:\Users\willi\AppData\Local\Temp\RtmpM5tsC7\file1a1068734a49/A
> 
> SPACE/log.txt': No such file or directory
> 
>>  unlink(logname)
>>  
>>   system(paste(
>>  "C:\\msys64\\home\\willi\\ucrt3\\r\\trunk\\bin\\R.exe --quiet
>>  --vanilla -e \"commandArgs()\" 1>", logname))
> 
>  [1] 0
> 
>>  tryCatch(readLines(logname), error=function(e)conditionMessage(e))
> 
>  [1] "cannot open the connection"
> 
> Warning message:
> 
> In file(con, "r") :
> 
>  cannot open file
> 
> 'C:\Users\willi\AppData\Local\Temp\RtmpM5tsC7\file1a1068734a49/A
> 
> SPACE/log.txt': No such file or directory
> 
>>  tryCatch(readLines(sub(" .*$", "", logname)),
>>  error=function(e)conditionMessage(e))
> 
>  [1] "> commandArgs()"
> 
>  "[1]
> 
> \"C:msys64homewilliucrt3rtrunk/bin/x64/Rterm.exe\""
> 
> [3] "[2] \"--quiet\"
> 
> " "[3] \"--vanilla\"
> 
>  "
> 
> [5] "[4] \"-e\"
> 

[R] Calculating number of elapsed days from starting date

2012-09-26 Thread Marcel Curlin
Hi 
I have data for events in rows, with columns for person and date. Each
person may have more than one event;

tC <- textConnection("
Person  date
bob 1/1/00
bob 1/2/00
bob 1/3/00
dave1/7/00
dave1/8/00
dave1/10/00
kevin   1/2/00
kevin   1/3/00
kevin   1/4/00
")
data <- read.table(header=TRUE, tC)
close.connection(tC)
rm(tC)

I would like to add a new column to my dataframe containing the calculated
number of elapsed days from the starting date for each person. So the new
dataframe would read

Person  dateDays
bob 1/1/00  0
bob 1/2/00  1
bob 1/3/00  2
dave1/7/00  0
dave1/8/00  1
dave1/10/00 3
kevin   1/2/00  0
kevin   1/3/00  1
kevin   1/4/00  2

Not sure how to do this, tried looking through the forum but didn't find
anything that seemed to apply. Suggestions appreciated.




--
View this message in context: 
http://r.789695.n4.nabble.com/Calculating-number-of-elapsed-days-from-starting-date-tp4644333.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] Performing operations only on selected data

2012-11-24 Thread Marcel Curlin
I spent some time on this simple question, also searched the forum,
eventually hacked my way to an ugly solution for my particular problem but I
would like to improve my coding:

I have data of the form:
df <- expand.grid(group=c('copper', 'zinc', 'aluminum', 'nickel'),
condition1=c(1:4))

I would like to add a new data column "condition2", with values equal to the
value of condition1 plus a random number from 0-1 (uniform distribution)  if
the value of condition1 is < 1, or just condition1 if the value of
condition1 is > 1. More generally, my interest is in manipulating the values
of condition1 if they meet one or more criteria, or keeping the values the
same otherwise. Thanks for any thoughts!

 



--
View this message in context: 
http://r.789695.n4.nabble.com/Performing-operations-only-on-selected-data-tp4650646.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.


Re: [R] Performing operations only on selected data

2012-11-25 Thread Marcel Curlin
Thank you, this works very well. My only remaining question about this is
about how ifelse is working; I understand the basic syntax (df$condition2
gets assigned the value *runif(nrow(df1[df1$condition1<=1,]),0,1)* or the
value *df$condition1* depending on whether or not df$condition1 meets the
criterion "<=1".

As I understand it, "runif(nrow(df1[df1$condition1<=1,]),0,1)" is a vector
of random values with vector length equal to the number of rows meeting
"df$condition1<=1" and df$condition1 is just my column of condition1 values.
So the command seems to be going down row by row and assigning condition2
values from one of two vectors in an "interleaved" way. 

So my question is, how does R keep track of which item in each of the
vectors to assign to condition2? For example, if the first 4 entries of
condition1 are 1, 3, 4, 1,  how does R know to use the *first* entry of
vector runif(nrow(df1[df1$condition1<=1,]),0,1) then the *second* and
*third* values of vector df$condition1, then the *second* value of vector
runif(nrow(df1[df1$condition1<=1,]),0,1)?



--
View this message in context: 
http://r.789695.n4.nabble.com/Performing-operations-only-on-selected-data-tp4650646p4650803.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] trouble with histograms

2010-10-26 Thread Marcel Curlin

Hi,
I have tab-delimited data with an unequal number of entries per column, of
the sort:

A   B   C
1   2   2
3   4   1
5   2   2   
6   2
5   2
3
6
2

I would like to make a histogram of the frequencies of each represented
number in a "stacked" histogram, where you can see the contribution of each
group (A, B or C) to the total height of the bar, and each bar labeled with
the represented number. So, there would be a bar labeled "1" of height 2,
half one color for group A, and half another color for group B.

So far,
I can get my data into a dataframe
>data <- read.table("myfile")

I think I first have to use "hist" to get the frequencies of each, and I
have figured out how to use breaks to make bins;
> bins=seq(0.5,6.5,by=1)
>hist(data$A, header=T, sep="\t", breaks=bins)

Lots of trouble from then on, though, and I just can't get this into a
usable plot. Any help appreciated.

Marcel
-- 
View this message in context: 
http://r.789695.n4.nabble.com/trouble-with-histograms-tp3014838p3014838.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] Recoding -- test whether number begins with a certain number

2010-11-03 Thread Marcel Gerds

 Dear R community,

I have a question concerning recoding of a variable. I have a data set
in which there is a variable devoted to the ISCO code describing the
occupation of this certain individual
(http://www.ilo.org/public/english/bureau/stat/isco/isco88/major.htm).
Every type of occupation begins with a number and every number added to
this number describes th occupation more detailed.
Now my problem: I want to recode this variable in a way that every value
beginning with a certain number is labeled as the respective category.
For example, that all values of this variable beginning with a 6 is
labeled as "agri".
My problem is that I cannot find a test which I can use for that purpose.

I would really appreciate any help on that subject. Thank you.

Best regards
Marcel Gerds

__
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] Choice Design -- partial profile

2010-08-11 Thread Marcel Gerds
Dear R community,

I have a question concerning the generation of an experimental design for 
discrete choice experiments (=choice based conjoint analysis, CBC). I 
understand that there is an article "Design and Analysis of Choice Experiments 
Using R" by Aizaki and Nishimura (available at 
http://www.jstage.jst.go.jp/article/air/17/2/86/_pdf). The authors use 
gen.factorial-function of the AlgDesign package.
My problem is that I want to generate a partial profile design that is that 
only a subset of attributes are shown in each choice set (say 4 of 13). However 
this cannot be done with the R packages I checked so far.
Does any of you know about a package which provide such a functionality or can 
give some hints about programming it?

Thanks in adavance.

Regards
Marcel

--

__
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] while loop until end of file

2010-08-29 Thread Marcel Curlin

Hi Guys,
stumped by a simple problem. I would like to take a file of the form

Pair group param1
1   D   10
1   D   10
1   R   10
1   D   10
2   D   10
2   D   10
2   D   10
2   R   10
2   R   10
etc..

and for each pair, calculate the average of param1 for group D entries,
subtract from the average of param1 for the group R entries, and then write
the results (ie, AveParam1D  AveParam1R dif) in a tab delimited file. Below
is the start of my code. the difficulty i am having is in creating a while
loop that stops once there are no more lines to read from the input file.
also not sure of the best way to write in the results, though I think I
should use rbind. 

data <- data.frame(alldata)

i <- 1
# need appropriate while loop
{
ss <- subset(data, Pair==i)
ssD <- subset(ss, DR==D)
ssR <- subset(ss, DR==R)
p1 <- mean(ssD$Length)
p2 <- mean(ssR$Length)
dif <- p1-p2
out <- rbind(data.frame(P1, P2, diff)
i <-i + 1
}

write.table(out, file="out", quote=F, row.names=F, col.names=T, sep="\t")

I have spent an absurd amount of time trying to sort this out with the
manual and forum searches. Any suggestions appreciated. 

Marcel

-- 
View this message in context: 
http://r.789695.n4.nabble.com/while-loop-until-end-of-file-tp2399544p2399544.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] R code output issues

2010-09-03 Thread Marcel Curlin

Hi all,
I have a short R code file that I am using to perform calculations on a
dataset. I am having a few issues with output: 

1. Although my input data file is 2149 lines long, when I type "results.df"
from the command line, I get the appropriate calculation results for only
the first 46 rows. Same result if I "sink" the output to a file, and type
"results.df" at the command line. This creates a file with the first 46
entries. I do get the entire input data file back if I type "data", and I
can't see anything in my input file around line 46 that would account for
this. 

2. If I run the code from a file using the command
"source("TransmissionCalc2") with the "results.df" command embedded in the
file, there is no output to the terminal at all (or to the output file, if I
use sink). Sink just creates an empty file. 

So, not sure why my results dataframe seems to only include a small fraction
of the data, or why the write commands are ignored when embedded in the code
and called by "source("etc" 

CODE

rm(list = ls(all = TRUE))
alldata
<-read.table("/Users/marcel/Desktop/V1V2TransmAnalysis/3_transmissiondata",
header=T)
#sink("/Users/marcel/Desktop/V1V2TransmAnalysis/4_output")
data <- data.frame(alldata)
V1V2means <- with(data, tapply(V1V2, list(Pair, DR), mean))
V1V4means <- with(data, tapply(V1V4, list(Pair, DR), mean))
results.df <- data.frame(V1V2means, V1V4means, V1V2dif = V1V2means[, "R"] -
V1V2means[, "D"], V1V4dif = V1V4means[, "R"] - V1V4means[, "D"] )
data

SAMPLE OF INPUT DATA FILE

PairDRV1V2V1V4
1D63277
1D63277
1D63277
.


Thoughts greatly appreciated.

Marcel
-- 
View this message in context: 
http://r.789695.n4.nabble.com/R-code-output-issues-tp2526415p2526415.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.


Re: [R] R code output issues

2010-09-03 Thread Marcel Curlin

Thanks for the input

Adding "print" took care of the first problem. The output looks like what I
would expect, so I think the code is doing what I would like it to for the
first 44 observations. 

> print(results.df)
  DR  D.1  R.1 V1V2dif V1V4dif
1  68.92500 75.0 284.5250 296.   6.075  11.475
2  68.81081 67.0 287.7568 283.  -1.8108108  -4.7567568
3  65.43902 62.0 282.5366 279.  -3.4390244  -3.5365854
4  66.6 67.25000 286.7000 288.2500   0.650   1.550
5  68.94872 71.0 297.8462 305.   2.0512821   7.1538462
Etc..

When I use str(results.df) it does seem to indicate a short file of 44
observations.  

'data.frame':44 obs. of  6 variables:
 $ D  : num  68.9 68.8 65.4 66.6 68.9 ...
 $ R  : num  75 67 62 67.2 71 ...
 $ D.1: num  285 288 283 287 298 ...
 $ R.1: num  296 283 279 288 305 ...
 $ V1V2dif: num  6.08 -1.81 -3.44 0.65 2.05 ...
 $ V1V4dif: num  11.48 -4.76 -3.54 1.55 7.15 ...

So I am still left with that question..
-- 
View this message in context: 
http://r.789695.n4.nabble.com/R-code-output-issues-tp2526415p2526469.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] Modeling Binary x Binary Interactions with mlogit (and interpretation)

2011-01-27 Thread Marcel Gerds

Dear R community,

I am using the mlogit package to analyze discrete choice data. Apart 
from a main effects model, I want to estimate interactions between the 
attributes of the choice set (e.g. the existence of a certain attribute) 
and some subject-specific data (like gender or income).
Studying the mlogit documentation, I found no hint on how to do it. In 
the literature there is only the case discussed how alternative-specific 
variables can be combined. In my case, the alternatives are of no 
interest, meaning I am using a purely generic model.
So far, I tried to model these interactions by simple multiplying the 
variables.


Example:
mlogit.model <- mlogit(CHOICE ~ ATR1+ATR2+ATR3 + ATR1*GENDER + 
ATR1*GENDER + ATR1*GENDER| -1, data=data_ml)


Here, gender is subject-specific.

I get results like the following:

---
Coefficients :
   Estimate
ATR1_yes  0.779116
ATR2_ yes 2.257905
ATR3_ yes1.141625
GENDERfem -14.026649
ATR1_yes :GENDERfem 0.094709
ATR2_ yes:GENDERfem-0.076223
ATR3_ yes:GENDERfem0.117373
---

I present only the coefficients here. However, when I change the 
reference level to male, the coefficients of the interactions effects 
just change sign.


I have two questions in this regard:

1.) Is the modeling of such interactions effect feasible in the mlogit 
setting?
2.) I have some problem understanding the changing sign of the 
coefficients when I change the reference level. This would imply that 
females always prefer the opposite of males. Clearly, this cannot be. I 
imagine that I am misinterpreting this issue and I would be grateful for 
any help on this.


Best regards,
Marcel

--
Marcel Gerds, M.Sc.
University of California
Department of Agricultural and Resource Economics
233 Giannini Hall
Berkeley, CA 94720

Tel.:  +1 510-643-2202
Mobil: +49 176 21302825

E-Mail: marcel.ge...@berkeley.edu
web:www.marcel-gerds.de

__
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] make an own (different) color legend with spplot()

2011-03-04 Thread Marcel J.

Hi!

Is there a way to manually costumize the color legend in an spplot() - 
especially where to draw ticks and labels for the ticks?


The reason I'm asking: Usually spplot() automatically divides the data 
into fitting slices and makes a color legend (also automatically).


I want to assign the slices myself and have a fixed scale instead of an 
automatic/dynamic scale.


I think what I want gets clear in this example:

library(sp)

data(meuse.grid)
gridded(meuse.grid) = ~x+y

## DATA GENERATION
meuse.grid$random <- rnorm(nrow(meuse.grid), 7, 2) # generate random data
meuse.grid$random[meuse.grid$random < 0] <- 0 # make sure there is no 
value is smaller than zero ...

meuse.grid$random[meuse.grid$random > 10] <- 10 # and bigger than ten
## DATA GENERATION FINISHED

## making a factor out of meuse.grid$ random to have absolute values 
plotted
meuse.grid$random <- cut(meuse.grid$random, seq(0, 10, 0.1)) # here I 
assign the levels I want to use in my plot!!!


spplot(meuse.grid, c("random"), col.regions = rainbow(100, start = 4/6, 
end = 1)) # look at the color-legend - not so good.


The graphic itself is like I want it, but the legend doesn't look too 
good. Although I assign 100 factors, I want just a few ticks in the 
legend (and also just a few labels).


How can this be achieved?

Thank you!

Marcel

__
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] make an own (different) color legend with spplot()

2011-03-04 Thread Marcel J.

Hi!

Is there a way to manually costumize the color legend in an spplot() - 
especially where to draw ticks and labels for the ticks?


The reason I'm asking: Usually spplot() automatically divides the data 
into fitting slices and makes a color legend (also automatically).


I want to assign the slices myself and have a fixed scale instead of an 
automatic/dynamic scale.


I think what I want gets clear in this example:

library(sp)

data(meuse.grid)
gridded(meuse.grid) = ~x+y

## DATA GENERATION
meuse.grid$random <- rnorm(nrow(meuse.grid), 7, 2) # generate random data
meuse.grid$random[meuse.grid$random < 0] <- 0 # make sure there is no 
value is smaller than zero ...

meuse.grid$random[meuse.grid$random > 10] <- 10 # and bigger than ten
## DATA GENERATION FINISHED

## making a factor out of meuse.grid$ random to have absolute values 
plotted
meuse.grid$random <- cut(meuse.grid$random, seq(0, 10, 0.1)) # here I 
assign the levels I want to use in my plot!!!


spplot(meuse.grid, c("random"), col.regions = rainbow(100, start = 4/6, 
end = 1)) # look at the color-legend - not so good.


The graphic itself is like I want it, but the legend doesn't look too 
good. Although I assign 100 factors, I want just a few ticks in the 
legend (and also just a few labels).


How can this be achieved?

Thank you!

Marcel

__
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 panel background color in spplot()

2011-03-05 Thread Marcel J.

Hi!

How does one change the background color of the map-panel in spplot()?

Example:

library(sp)

data(meuse.grid)
gridded(meuse.grid) = ~x+y

spplot(meuse.grid, "part.a")

How would I get another background-color for the map-panel (but not for 
the whole plot) here?


Thank you!

Marcel

__
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] Change panel background color in spplot()

2011-03-05 Thread Marcel J.

Thank you, Jannis!

I came as far as that:

library(sp)

data(meuse.grid)
gridded(meuse.grid) = ~x+y

spplot(meuse.grid, zcol = "part.a", sp.layout= list("panel.fill", "grey"))

but here not only the background is grey. Instead the whole panel turns 
grey...


Help would be appreciated!

Thank you,

Marcel


Am 2011-03-05 15:23, schrieb Jannis:
I would guess it works the same as for standard trellis graphs. 
Googleing:


trellis R change panel background

gives you links to some discussions about these issues.




HTH
Jannis


On 03/05/2011 01:06 PM, Marcel J. wrote:

Hi!

How does one change the background color of the map-panel in spplot()?

Example:

library(sp)

data(meuse.grid)
gridded(meuse.grid) = ~x+y

spplot(meuse.grid, "part.a")

How would I get another background-color for the map-panel (but not 
for the whole plot) here?


Thank you!

Marcel

__
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] linear regression in a ragged array

2011-03-21 Thread Marcel Curlin
Hello,
I have a large dataset of the form

subj   var1   var2   
001100200
001120226
001130238
001140245
001150300
002110205
002125209
003101233
003115254

I would like to perform linear regression of var2 on var1 for each subject
separately. It seems like I should be able to use the tapply function as you
do for simple operations (like finding a mean of var1 for each subject), but
I am not sure of the correct syntax for this. Is there a way to do this?

Many thanks, Marcel

--
View this message in context: 
http://r.789695.n4.nabble.com/linear-regression-in-a-ragged-array-tp3393033p3393033.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] Loop for multiple plots in figure

2012-06-24 Thread Marcel Curlin
Hello, I have longitudinal data of the form below from N subjects; I am
trying to create figure with N small subplots on a single page, in which
each plot is from only one subject, and in each plot there is a separate
curve for each value of param1. 

So in this case, there would be four plots on the page (one each for Bob,
Steve, Kevin and Dave), and each plot would have two separate curves (one
for param1 = 1 and one for param1 = 0). The main title of the plot should be
the subject name. I also need to sort the order of the plots on the page by
param2.

I can do this with a small number of subjects using manual commands. For a
larger number I know that a 'for loop' is called for, but can't figure out
how to get each of the subjects to plot separately, could not figure it out
from the existing posts.  For now I want to do this in the basic environment
though I know that lattice could also work (might try that later). Any help
appreciated

tC <- textConnection("
Subject XvarYvarparam1  param2
bob 9   100 1   100
bob 0   250 1   200
steve   2   454 1   50
bob -5  271 0   35
bob 3   10  0   74
steve   1   500 1   365
kevin   5   490 1   546
bob 8   855 0   76
dave2   233 0   343
steve   -10 388 0   556
steve   -7  284 1   388
dave3   568 1   555
kevin   4   247 0   57
bob 6   300 1   600
")
data <- read.table(header=TRUE, tC)
close.connection(tC)
rm(tC)

par(mfrow=c(2,2)

--
View this message in context: 
http://r.789695.n4.nabble.com/Loop-for-multiple-plots-in-figure-tp4634390.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.


Re: [R] Loop for multiple plots in figure

2012-06-26 Thread Marcel Curlin
This solution works really nicely & I learned much by working through it.
However but I am having trouble with subplot formatting; setting
main=d$Subject results in the correct title over each plot but repeated
multiple times. Also I can't seem to format the axis labels and numbers to
reduce the space between them and the plot. Any more thoughts appreciated. 

revised code:

tC <- textConnection("
Subject XvarYvarparam1  param2
bob 9   100 1   100
bob 0   110 1   200
steve   2   250 1   50
bob -5  175 0   35
dave22  260 0   343
bob 3   180 0   74
steve   1   290 1   365
kevin   5   380 1   546
bob 8   185 0   76
dave2   233 0   343
steve   -10 230 0   556
dave-10 233 1   400
steve   -7  250 1   388
dave3   568 0   555
kevin   10  380 0   57
kevin   4   390 0   50
bob 6   115 1   600
")
data <- read.table(header=TRUE, tC)
close.connection(tC)
rm(tC)

plot_one <- function(d){
 with(d, plot(Xvar, Yvar, t="n", tck=0.02, main=d$Subject, xlim=c(-14,14),
ylim=c(0,600))) # set limits
 with(d[d$param1 == 0,], points(Xvar, Yvar, col = 1)) # first line
 with(d[d$param1 == 1,], points(Xvar, Yvar, col = 2)) # second line

}

par(mfrow=c(2,2))
plyr::d_ply(data, "Subject", plot_one)

--
View this message in context: 
http://r.789695.n4.nabble.com/Loop-for-multiple-plots-in-figure-tp4634390p4634482.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.


Re: [R] Loop for multiple plots in figure

2012-06-27 Thread Marcel Curlin
Well at this point I have what I need (rough plot for data exploration) but
the simplicity of the first approach is quite elegant and it has become a
learning project. I have succeeded in formatting the overall plot OK but
have not been able to solve the problem of titles or any kind of
label/legend for the subplots. It seems that the title is called for each
datapoint, and then printed one below the other in the plot. Is there any
way at all to get a specific legend/title/text on each subplot?

Marcel



--
View this message in context: 
http://r.789695.n4.nabble.com/Loop-for-multiple-plots-in-figure-tp4634390p4634649.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] Influence of subdataset

2007-11-29 Thread Marcel Sandow
Dear r-helpers!

Two closely related questions:

1) I would like to analyse the influence of a subdataset on the whole dataset 
(50 out of 350 datapoints) linear regression slope. I have read about 
influence.measures but this analyses only single datapoint. 

2) I would like to compare the slope of the whole dataset with the slope of a 
subdataset consisting of the maximum values of 10 equal x-axis classes.

any suggestions?

Thanks

Marcel 

__

Marcel Sandow

Leibniz Institute of Marine Sciences - IFM-Geomar
Experimental Ecology: Foodwebs
Düsternbrooker Weg 20
24105 Kiel
Germany

Fon: +49-431-600-4404
Fax: +49-431-600-1515

Homepage: http://www.ifm-geomar.de
E-mail: [EMAIL PROTECTED]

__
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] extract year or month from date

2007-10-09 Thread Marcel Sandow
Highto convert strings into date use the:"? strptime" command, it converts data 
into POSIXlt classthis class provides direct access to some details of your 
date time information, likea<-strptime("07/07/1992",format="%d/%m/%Y")"a$mon+1" 
gives you the month (+1 because POSIXlt uses 0-11 for months counts)"a$year" 
gives you the yearMarcel Sandow- Ursprüngliche Nachricht -Von: Mary 
Royerr Datum: Dienstag, Oktober 9, 2007 3:39 pmBetreff: [R] extract year or 
month from dateAn: r-help@r-project.org> Hi,> > I am having trouble extracting 
just the year or the month or the > day from a> date such as 5/7/2007 which is 
May 7th 2007. Is there any particular> function to extract just the year from 
this format?> > When I am reading this data from a text file it is reading it > 
correctly in> the same format but does not acknowlede it as date but as a > 
factor. If I try> as.date(5/7/2007) then it is converting it to 1Jan1960. Weird 
it > is. Any> help on that front?> > Any help is greatly appreciated.> >   
[[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.> 

__

Marcel Sandow

Leibniz Institute of Marine Sciences - IFM-Geomar
Experimental Ecology: Foodwebs
Düsternbrooker Weg 20
24105 Kiel
Germany

Fon: +49-431-600-4404
Fax: +49-431-600-1515

Homepage: http://www.ifm-geomar.de
E-mail: [EMAIL PROTECTED]



[[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] axis title on two lines

2007-10-30 Thread Marcel Sandow
Hello,I am searching for the possibility to make a two lines axis title. This 
suggestion:ylab=expression(paste("log rate\n[ fluor.",inc. %.% cell^{-1} %.% 
sec^{-1}," ]"))results in two lines left not centered and with a large gap.any 
suggestions.ThanksMarcel 

__

Marcel Sandow

Leibniz Institute of Marine Sciences - IFM-Geomar
Experimental Ecology: Foodwebs
Düsternbrooker Weg 20
24105 Kiel
Germany

Fon: +49-431-600-4404
Fax: +49-431-600-1515

Homepage: http://www.ifm-geomar.de
E-mail: [EMAIL PROTECTED]



[[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] axis title on two lines

2007-10-30 Thread Marcel Sandow
Thanksmtext is exactly what I am looking for. Using \n inside gave the same 
results as before. But using two independent mtext code lines with defferent 
line settings worked perfectly.- Ursprüngliche Nachricht -Von: John 
Kane Datum: Dienstag, Oktober 30, 2007 2:56 pmBetreff: Re: [R] axis title on 
two linesAn: Marcel Sandow , [EMAIL PROTECTED]> You might want to replace the 
xlab with mtext? > > aa <- 1:10> plot(aa, xlab='')> mtext("label one \n label 
number two" , side=1,> line=3)> > > --- Marcel Sandow  wrote:> > > Hello,I am 
searching for the possibility to make a> > two lines axis title. This> > 
suggestion:ylab=expression(paste("log rate\n[> > fluor.",inc. %.% cell^{-1} %.% 
sec^{-1},"> > ]"))results in two lines left not centered and with> > a large 
gap.any suggestions.ThanksMarcel > > > >> 
__> 
> > > Marcel Sandow> > > > Leibniz Institute of Marine Sciences - IFM-Geomar> > 
Experimental Ecology: Foodwebs> > Düsternbrooker Weg 20> > 24105 Kiel> > 
Germany> > > > Fon: +49-431-600-4404> > Fax: +49-431-600-1515> > > > Homepage: 
http://www.ifm-geomar.de> > E-mail: [EMAIL PROTECTED]> > > > > > > >
[[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.> > > > > >  Be 
smarter than spam. See how smart SpamGuard is at giving > junk email the boot 
with the All-new Yahoo! Mail at > http://mrd.mail.yahoo.com/try_beta?.intl=ca> 

__

Marcel Sandow

Leibniz Institute of Marine Sciences - IFM-Geomar
Experimental Ecology: Foodwebs
Düsternbrooker Weg 20
24105 Kiel
Germany

Fon: +49-431-600-4404
Fax: +49-431-600-1515

Homepage: http://www.ifm-geomar.de
E-mail: [EMAIL PROTECTED]



[[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] Estimate a logit of shares

2007-11-07 Thread Trevor Marcel
Hello,

I would like to estimate a logit with aggregated data. Each line 
describes an observation with the following fields :
- share of choice A
- share of choice B
- share of choice C
- Var.A1 (specific to choice A)
- Var.A2 (specific to choice A)
- Var.B1 (specific to choice B)
- Var.B2 (specific to choice B)
- Var.C1 (specific to choice C)
- Var.C2 (specific to choice C)

The sum of shares is equal to 1.

Var.A1 and Var.A2 are specific only for the choice A. These variables 
have no potential explanation of the choice B or C.

Is there any function to estime this LOGIT in R?

Thanks for any help.

Pierre-Olivier Chasset



 
-

 
-

[[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] Estimate a logit of shares

2007-11-12 Thread Trevor Marcel
Michael,

I look at it.

Thanks for this first path.

Pierre-Olivier




  
_ 

l 
[[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] Optim and hessian

2009-04-29 Thread Marcel Rodrigues Lopes
Hi, my name is Marcel R. Lopes. My problem is,

I made a code to calculate the estimates of a Cox model with random effects.
Used to optimize the R command for this. The estimates were calculated
correctly, but the Hessian matrix does not have good values. The same thing
was done in SAS and gave good results for the Hessian Matrix. Where is the
problem in R? As the Hessian is calculated?. How could I solve this
problem?. I would be grateful if you could help me 

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