Displaying 20 results from an estimated 2000 matches similar to: "Problem with predict?"
2008 Sep 30
1
Using sub to get captions in barplots
All,
I've been using "sub" (subtitle) instead of "main" such that captions are
below figures produced by xyplot. This works fine and captions are on a
single line. However, when I try this for bar plots with error bars
(altering the error.bars function form Crawley's The R Book, see below), the
captions are split on more than 1 line. Is there a way to get the
2008 Sep 06
2
Hopefully an easy error bar question
Hi im trying to add error bars to my barplots, there very basic, i have a few grapghs where the y variable is different but on all the X variable is Age (Adult and Juvenile) however this is split into two levels so i have males and females, so my graph basically has four bars on it.
I know how to add eror bars for instance when there is only one level eg lookng at the diffrence between male and
2018 Jan 30
0
Calculating angle of a polyline
I like to use complex numbers for 2-dimensional geometry. E.g.,
> polyAngles2
function (xV, yV)
{
stopifnot((length(xV) == length(yV)) && (length(xV) >= 3))
z <- complex(re = xV, im = yV)
c(NA, diff(Arg(diff(z))), NA) # radians, positive is counter-clockwise
}
> x <- c(0:3)
> y <- c(0,0,1,1)
> polyAngles2(x,y) / pi * 180
[1] NA 45 -45 NA
Bill
2018 Jan 30
2
Calculating angle of a polyline
Assuming your polyline is defined by two vectors, one for the x
coordinates, one for the y coordinates, you can try the following
library(NISTunits)
polyangles <- function(xV,yV) {
stopifnot( (length(xV)==length(yV)) && (length(xV) >= 3))
v <- function(i) { c( xV[i]-xV[i-1], yV[i]-yV[i-1])}
vlen <- function(v) { sqrt(sum(v*v)) }
lV <- rep(NA_real_,length(xV))
for
2011 Feb 15
1
Passing Arguments in a function
Hi All,
I'm having some trouble assigning arguments inside a function to
produce a plot from a model
Can anyone help me? Below I've outlined the situation and examples of
failing and working code.
Regards
Mike
## data ##
decay.data <- ...
behaviors lift reach.uu estimated.conversions.uu total.reach
1 1 432.0083 770 770 0.00
2
2011 Oct 04
1
Rug plot curve reversal
Dear R-help
Can anyone tell me why my curve appears the wrong way round on a rug plot?
I am using the same code as on pg 596 of the Crawley R-book.
mod<-glm(mort~logBd,binomial)
par(mfrow=c(2,2))
xv<-seq(0,8,0.01)
yv<-predict(mod,list(logBd=xv),type="response")
plot(logBd,mort)
lines(xv,yv)
I've tried swapping xv and yv around but no luck.
Thanks,
Pete
2011 May 26
2
Plot binomial regression line
Dear all,
I am quite new with R and I have a problem with plotting a binomial
regression line in a plot.
This is what I type in:
> model<-glm(Para~Size,binomial)
> par(mfrow=c(1,1))
> xv<-seq(3.2,4.5,0.01)
> yv<-predict(model,list(area=xv),type="response")
> plot(Size,Para)
> lines(xv,yv)
The error message that I get is:
> Error in xy.coords(x, y) :
2011 Nov 09
3
Help with tryCatch with a for loop
Hello all,
I'm a beginner in R working on a script that will produce a set of models
(linear, polynomial and logistic) for each location in a dataset. However,
the self-starting logistic model often fails - if this happens I would like
to just skip to the next iteration of the loop using tryCatch.
I've looked at a few examples and read the help file, but didn't understand
tryCatch
2017 Jun 14
4
[FORGED] Re: draw stripes in a circle in R
On 15/06/17 05:29, David Winsemius wrote:
>
>> On Jun 14, 2017, at 10:18 AM, David Winsemius <dwinsemius at comcast.net> wrote:
>>
>>
>>> On Jun 14, 2017, at 9:46 AM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:
>>>
>>> I don't see a question. If your question is whether R supports pattern fills, AFAIK it does not. If that is
2017 Jun 14
0
draw stripes in a circle in R
> On Jun 14, 2017, at 10:18 AM, David Winsemius <dwinsemius at comcast.net> wrote:
>
>
>> On Jun 14, 2017, at 9:46 AM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:
>>
>> I don't see a question. If your question is whether R supports pattern fills, AFAIK it does not. If that is not your question, ask one.
>> --
>> Sent from my
2010 Sep 28
1
95% confidence intercal with glm
Hi
I had to use a glm instead of my basic lm on some data due to unconstant
variance.
now, when I plot the model over the data, how can I easily get the 95%
confidence interval that sormally coming from:
> yv <- predict(modelVar,list(aveLength=xv),int="c")
> matlines(xv,yv,lty=c(1,2,2))
There is no "interval" argument to pass to the
2017 Jun 14
0
[FORGED] Re: draw stripes in a circle in R
> On Jun 14, 2017, at 1:53 PM, Rolf Turner <r.turner at auckland.ac.nz> wrote:
>
> On 15/06/17 05:29, David Winsemius wrote:
>>> On Jun 14, 2017, at 10:18 AM, David Winsemius <dwinsemius at comcast.net> wrote:
>>>
>>>
>>>> On Jun 14, 2017, at 9:46 AM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:
>>>>
2017 Jun 15
2
[FORGED] Re: draw stripes in a circle in R
Sigh. I never load packages in .Rprofile to avoid the irreproducibility trap. Might seem drastic to some, but I don't feel much pain because I almost always edit my code in a file rather than on the fly at the console, and re-run it frequently from a fresh R process to check my progress.
--
Sent from my phone. Please excuse my brevity.
On June 14, 2017 3:27:15 PM PDT, David Winsemius
2017 Jun 14
1
[FORGED] Re: draw stripes in a circle in R
Envoy? depuis mon appareil Samsung
-------- Message d'origine --------
De : Rolf Turner <r.turner at auckland.ac.nz>
Date : 14/06/2017 22:53 (GMT+01:00)
? : David Winsemius <dwinsemius at comcast.net>
Cc : r-help at r-project.org
Objet : Re: [R] [FORGED] Re: draw stripes in a circle in R
On 15/06/17 05:29, David Winsemius wrote:
>
>> On Jun 14, 2017, at
2011 Mar 20
4
predicting values from multiple regression
Hey List,
I did a multiple regression and my final model looks as follows:
model9<-lm(calP ~ nsP + I(st^2) + distPr + I(distPr^2))
Now I tried to predict the values for calP from this model using the
following function:
xv<-seq(0,89,by=1)
yv<-predict(model9,list(distPr=xv,st=xv,nsP=xv))
The predicted values are however strange. Now I do not know weather
just the model does not fit
2017 Jun 15
1
draw stripes in a circle in R
hi david
Thank you very much for the hack of draw.circle that you proposed me.
I don't understand some part of the code, why do you pass radius as a
vector in the function (if I understand well the purpose of the for
loop) ? Also what is ymult?
If I set the radius to the value 0.85 as I wanted (so as a scalar), I
don't see any difference in the result when I call this function
2003 Aug 11
0
Designing and incorporating a digital filter
I have a time series of data from an electroencephalogram (EEG).
I wish to filter the data to get rid of 50Hz mains 'hum'. I have
'designed' a combination bandpass and notch filter using a web-
site. The site returns the filter in "ANSI C" source code. It is:-
/* Digital filter designed by mkfilter/mkshape/gencode A.J. Fisher
Command line:
2009 Mar 11
4
error.bars
Hi, I'm trying to use the function "error.bars", but the program don't
find it, and I dont't found any package with this function. Is there some
another functin to draw barplots with error bars?
Sueli Rodrigues
Eng. Agr?noma - UNESP
Mestranda - USP/ESALQ
PPG-Solos e Nutri??o de Plantas
Fones (19)93442981
(19)33719762
2018 Jan 30
2
Calculating angle of a polyline
Dear R users
I am trying to find a formula to calculate the angle of a polyline. Is
there a way to do this?
Many thanks.
--
Best Regards
Javad Bayat
M.Sc. Environment Engineering
Alternative Mail: bayat194 at yahoo.com
[[alternative HTML version deleted]]
2018 Jan 30
0
Calculating angle of a polyline
A polyline by definition has many angles, so your question is ill-formed. And this is a question about math, not R, so is off topic here. I suggest reading Wikipedia.
--
Sent from my phone. Please excuse my brevity.
On January 29, 2018 11:10:02 PM PST, javad bayat <j.bayat194 at gmail.com> wrote:
>Dear R users
>I am trying to find a formula to calculate the angle of a polyline. Is