[R] Contract work for non-linear regressions

2022-05-09 Thread Marlin Keith Cox
I am not sure if this is appropriate here, my apologies if not. I have used R for 20 years now and need help with non-linear regression analysis over 100's of different frequencies and my data has exceeded by R program capabilities. My company would provide the contract. keith M. Keith Cox, Ph.

[R] Time series and correlation

2022-04-26 Thread Marlin Keith Cox
Hi all, I have three columns. Resistance, Time and Frequency, and I need to find correlations between Resistance and Time by each of 100 Frequencies. I have set Frequencies to be a factor. Time is in the format "%m/%d/%Y %H:%M:%S", but correlations dont seem to like Time data. I can run this code

[R] correlation by factor

2021-07-27 Thread Marlin Keith Cox
I am having problems making a correlation/association between two variables by a factor. In the case below, I need to know the correlation between R and Day at each frequency (a1-a5). Each frequency would have a corresponding correlation between R and day. I have found a lm function that is simil

[R] dates by week multiple years

2019-02-05 Thread Marlin Keith Cox
Hello all, I did not attach data as this is probably simple answer that I cannot find. I am collecting daily data and would like to plot the data by week but now that we are into the new year, my plots started over with 01 after the last week of the year. How can I continuously keep adding weeks

[R] error.crosses

2016-04-27 Thread Marlin Keith Cox
Hello all, I have used describeBy to generate the following summary statistics. I simply need x and y error bars on a plot that has CQN (xaxis) and Price (yaxis). There should be four total points on the graph (one for each supplier). Using "error.crosses(desc$CQN, desc$Price)" does not work.

[R] error.crosses

2016-04-27 Thread Marlin Keith Cox
Hello all, I have used describeBy to generate the following summary statistics. I simply need x and y error bars on a plot that has CQN (xaxis) and Price (yaxis). There should be four total points on the graph (one for each supplier). Using "error.crosses(desc$CQN, desc$Price)" does not work.

Re: [R] Reordering of numerical vector

2015-10-21 Thread Marlin Keith Cox
Got it. During a read.csv I used stringsAsFactors=FALSE M. Keith Cox, Ph.D. Principal MKConsulting 17105 Glacier Hwy Juneau, AK 99801 U.S. 907.957.4606 On Wed, Oct 21, 2015 at 10:31 AM, Marlin Keith Cox wrote: > I do not have a dataset to share as I do not believe it needs it and I am &g

[R] Reordering of numerical vector

2015-10-21 Thread Marlin Keith Cox
I do not have a dataset to share as I do not believe it needs it and I am not sure I could reproduce easily. I have a column of numerical data (Days) and another of a a measurement (Resistance). After subsetting, I do a linear regression of the two, and it reorders the day (x axis) into some other

[R] Subsets of a function

2014-05-19 Thread Marlin Keith Cox
Hi all, this is a reoccurring theme in my programming and I need some help with it. When I use a built in function and need to use it on a subset of my data frame, I always end up using the subset function first, but this seems very clunky. For example, if I have years 2003:2013 with season "a" a

[R] Time series

2014-04-01 Thread Marlin Keith Cox
A simplified ask is: when I use the time series plot function, R treats each time on 9/19/13 as an individual day, when clearly it isn't. Thank you ahead of time. Keith ts(chum) with(chum,plot.ts(Time,PA)) Chum<- Time PA 9/18/13 18:29 16 9/19/13 13:29 14 9/19/13 16:29 13.2 9/19/13 17:29

[R] predict model time series

2014-02-21 Thread Marlin Keith Cox
I am using a gam for a model predictor and need to forecast into the future based off data collected earlier. I would like to predict fish weight on day 10 from measures taken on a fish from day 2. This seems simple, but using predict, I have only been able to predict weight for a given day. A s

[R] Time series and lm

2013-12-17 Thread Marlin Keith Cox
Hello all, I have a time series defined by chum$Time1<-as.POSIXlt(chum$Time, format= "%m/%d/%y %H:%M") and a measured parameter pa.s When I create a linear model with(chum.skin, lm(Time1~pa.s)) I get the following error. Error in model.frame.default(formula = Time1 ~ pa.s, drop.unused.levels

[R] X11 and printing/copying graphics from mac

2013-08-01 Thread Marlin Keith Cox
Hello all, I frequently use R, but recently have switched to a mac. When creating a new graphic, I have used X11() for a new graphics window and have always (when I used my PC) have been able to copy or print from this graphic window. With my mac, it does not allow me to copy or print. Having mu

[R] Plot label symbols and superscript

2011-08-19 Thread Marlin Keith Cox
I was unable to find an answer to my problem. I would like to label the y axis of a plot with a rate and would like to use a dot (•) rather than a multiplication sign (x). ylab = quote(Speed~(cmxsec^2)) Thanks in advance. keith -- M. Keith Cox, Ph.D. Alaska NOAA Fisheries, National Marine

Re: [R] color under lm line

2011-03-14 Thread Marlin Keith Cox
: > > co <- coef(llm) > bord <- pmin(y, co[1] + co[2] * x) > plot(x,y) > polygon(c(x, x[length(x)]), c(bord, bord[1]), col = 'red') > abline(co) > > HTH, > Dennis > > On Mon, Mar 14, 2011 at 4:02 PM, Marlin Keith Cox > wrote: > >>

[R] color under lm line

2011-03-14 Thread Marlin Keith Cox
Hi, I would like to add a color under a lm line and not the plotted line. Is this possible? In the example, I do not want the area under the curve red, but rather under the llm line. x=seq(0,5,len=100) y=-(x-5)^2 llm<-lm(y~x) plot(x,y) polygon(c(x,x[length(x)]), c(y, y[1]), col='red') abline(ll

[R] move colorkey

2010-09-28 Thread Marlin Keith Cox
When using a wireframe, I need to move the colorkey from the "right" position (default0 towards the plot. I have also needed to adjust the height and used the code colorkey=list(T,space='right',height=.5) I have looked at documents (within levelplot) but cannot find a way to move the colorkey ot

[R] NLS equation self starting non linear

2010-09-02 Thread Marlin Keith Cox
This data are kilojoules of energy that are consumed in starving fish over a time period (Days). The KJ reach a lower asymptote and level off and I would like to use a non-linear plot to show this leveling off. The data are noisy and the sample sizes not the largest. I have tried selfstarting we

Re: [R] non-linear plot parameters

2010-09-01 Thread Marlin Keith Cox
e-12),trace=TRUE) > summary(model) > > As always, thank you...keith > > > > > On Fri, Aug 27, 2010 at 10:59 AM, Peter Ehlers wrote: > >> Just a small fix to my solution; inserted below. >> >> >> On 2010-08-27 3:51, Peter Ehlers wrote: >>

Re: [R] non-linear plot parameters

2010-08-31 Thread Marlin Keith Cox
-Peter Ehlers > > > >> (which will often give the converged values). You can >> follow up with >> >> fm <- nls(Level ~ Asym-Drop*exp(-exp(lrc)*Time^pwr), start = init) >> >> -Peter Ehlers >> >> >>> kc >>> On Thu, Aug 26, 20

Re: [R] non-linear plot parameters

2010-08-26 Thread Marlin Keith Cox
know how to do this, seek further statistical help. > > -- > Bert Gunter > Genentech Nonclinical Statistics > > > > > > The data originally posted was an example of one of the curves > experienced. > > > > kc > > > > On Thu, Aug 26, 20

Re: [R] non-linear plot parameters

2010-08-26 Thread Marlin Keith Cox
10 at 1:42 PM, David Winsemius wrote: > > On Aug 26, 2010, at 5:20 PM, Marlin Keith Cox wrote: > > The background you requested are energetic level (joules) in a group of > starved fish over a time period of 45 days. Weekly, fish (n=5) were removed > killed and measured for

Re: [R] non-linear plot parameters

2010-08-26 Thread Marlin Keith Cox
:48 AM, David Winsemius wrote: > > On Aug 26, 2010, at 1:35 PM, Marlin Keith Cox wrote: > > I need the parameters estimated for a non-linear equation, an example of >> the >> data is below. >> >> >> # rm(list=ls())I really wish people would add

[R] non-linear plot parameters

2010-08-26 Thread Marlin Keith Cox
I need the parameters estimated for a non-linear equation, an example of the data is below. rm(list=ls()) Time<-c( 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 8, 8, 8, 8, 8) Level<-c( 100, 110, 90, 95, 87, 60, 65, 61, 55, 57, 40, 41, 50, 47, 44, 44, 42,

[R] nls self starting function

2010-08-25 Thread Marlin Keith Cox
I need the simple function for the following set of data. This is a toy version of my data, but the error is persistent in both. To compare with excel, I would just 1) format trendline, 2) display equation and R-squared on chart. I obviously tried to use a nls and wanted to use the self startup

[R] hide scatter points

2010-07-09 Thread Marlin Keith Cox
I need to hide scatter points and just leave the linear regression line. I have tried to color the points "white", but that does not work. A working example, I need the green plotted points to be transparent or hidden. x2 <- seq(1,200,.5) y2 <- seq(5,204,.5) plot(x2, y2, pch=16, col="green") mod

[R] grayscale wireframe??

2010-07-06 Thread Marlin Keith Cox
I need grayscale formatting for a wireframe. The only col.regions that I can find are color palettes are all colored: rainbow(n, s = 1, v = 1, start = 0, end = max(1,n - 1)/n, gamma = 1, alpha = 1) heat.colors(n, alpha = 1) terrain.colors(n, alpha = 1) topo.colors(n, alpha = 1) cm.colors(n, al

[R] t.test data in one column

2010-04-01 Thread Marlin Keith Cox
I need a two sample t.test between M and F. The data are arranged in one column, x. Cant seem to figure how to run a two sample t.test. Not really sure what this output is giving me, but there should be no difference between M and F in the example, but summary p-value indicates this. How can I

[R] simple subtraction in a single vector

2010-02-09 Thread Marlin Keith Cox
OK, this is very elementary, but I need help. I have looked in Verzani, past postings etc. Problem: I need to subtract the "length" date between "h4" and "a3" #which would be 4-1 I would rather not convert the two columns into four columns (with headings being "a3","a4","c4","h4"). DF <- data

Re: [R] Subset and plot

2010-02-02 Thread Marlin Keith Cox
otting symbols and ``Tanks'' has *four* distinct > values, this is somewhat mysterious. > > If you would just tell us what you are actually trying to *do* we would > probably be able to tell you how to do it. > >cheers, > >

Re: [R] Subset and plot

2010-02-02 Thread Marlin Keith Cox
gt; > c(2,19,21)[Tanks] > with(daily.sub1,c(2,19,21)[Tanks]) > > Avoid attach and use with which is a temporary attach that won't be subject > to that problem. > > --jeff > > On 2/2/2010 11:51 AM, Marlin Keith Cox wrote: > >> Here is a runable program. Wh

[R] Subset and plot

2010-02-02 Thread Marlin Keith Cox
Here is a runable program. When I plot Day and Wgt, it graphs all the data points. All I need is daily.sub1 plotted. I also need each "Tanks" to have its own col or pch. When I run it with the line with pch, it gives me nothing. rm(list=ls()) Trial<-rep(c(1,2),each=12) Tanks=rep(c("a3","a4","c

[R] Subset and point plot

2010-02-02 Thread Marlin Keith Cox
OK, I need help plotting. I have column headings of Day, Wgt, Foodin, Rep, Grp and Tanks. Rep=c(1,2,3) and Tanks=c(a1,a2,a3,a4,a5,a6, c1,c2,c3,c4,c5,c6, h1,h2,h3,h4,h5,h6). I created a subset where I only would like Rep=2, and Tanks=c(a4,c4,h4) and would like to graph (points) of Wgt and Day. I

Re: [R] first and second derivative calculation

2010-01-22 Thread Marlin Keith Cox
2 > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Marlin Keith Cox > Sent: Friday, January 22, 2010 4:37 PM > To: r-help@r-project.org > Subject: [R] first and second derivative calculation > > I wo

[R] first and second derivative calculation

2010-01-22 Thread Marlin Keith Cox
I would like to calculate a first and second derivative and am having problems finding a simple solution. My syntax may be off as I am not a mathematician, so pardon ahead of time. data: t<-seq(0,4, by=.1) The function is: H(t) = t^3-6*t^2+5*t + 30 from here I plot the curve: plot(x,y ,xlab="x-va

[R] Point plot comparisions

2010-01-10 Thread Marlin Keith Cox
I would like to create a point plot with the following two sets of points: #1 plot(Day,Total) and #2 (Day,cons_hat). Total is the actual value seen and cons-hat is a predicted value. If possible, I do not want to stack them as they are quite long. (FYI, I did use the reshape on a previous post,

[R] Boxplots

2010-01-09 Thread Marlin Keith Cox
I have a data set with four columns and need to make boxplots from them. Data is as follows: tank TanksTotal cons_hat 1aa4 5.651017 5.59 2aa5 5.017499 5.29 3aa6 4.894238 4.69 4cc4 3.986347 3.40 5cc5 4.099442 3.58 6cc6 4.15052

[R] Time Series Data

2009-10-19 Thread Marlin Keith Cox
Hi all and thanks in advance. I am regressing Time and Weight, and then predicting Weight at different Time. The format of the Time data is day/month/year. How can I get R to use time series data such as this? Keith -- M. Keith Cox, Ph.D. Alaska NOAA Fisheries, National Marine Fisheries Servi

[R] Matrix addition and multiplication

2009-08-10 Thread Marlin Keith Cox
I posted this earlier, but am not certain that it was in fact posted, so I will try again. Hi, I have an equation Xcp and would like to look at errors affecting it. I am applying errors of -.58 to .1 to R and -.45 to .47 to Xc. I would like to look at all combinations. I set up a matrix functio

[R] Matrix function

2009-08-06 Thread Marlin Keith Cox
Hi, I have an equation Xcp and would like to look at errors affecting it. I am applying errors of -.58 to .1 to R and -.45 to .47 to Xc. I would like to look at all combinations. I set up a matrix function as follows and it does not work. On the last line, when it run, it does not seem like the

[R] wireframe color

2009-08-03 Thread Marlin Keith Cox
Hello, hopefully simple question, but I cannot find the answer. I need to change the color from the standard default. Still want the scaled colors, but need different colors for different graphs. Code is: wireframe(z ~ y*x, mat.df, drape = TRUE, zlab = list("Water mass error

[R] wireframe color

2009-07-30 Thread Marlin Keith Cox
Hello, hopefully simple question, but I cannot find the answer. I need to change the color from the standard default. Still want the scaled colors, but need different colors for different graphs. Code is: wireframe(z ~ y*x, mat.df, drape = TRUE, zlab = list("Water mass error

[R] wireframe color change from default

2009-07-30 Thread Marlin Keith Cox
Hello, hopefully simple question, but I cannot find the answer. I need to change the color from the standard default. Still want the scaled colors, but need different colors for different graphs. Code is: wireframe(z ~ y*x, mat.df, drape = TRUE, zlab = list("Water mass error

[R] axis label config mgp

2009-07-15 Thread Marlin Keith Cox
I have long axis labels (8units) on the x axis and 2 unit number labels on the y axis. I need to move the x axis title without moving the y axis title. I have used mgp=c(title, label and line), but mgp moves both the x and y titles. The following puts the y axis title way way out to the left. An

[R] Axes origins and labeling

2009-07-15 Thread Marlin Keith Cox
I have re-labeled tick marks on the x axis. The problem is that by using axes=FALSE, the axes disappears and when they are called back using axis(side=1)..etc. the axis on sides 1 and 2 do not meet at the bottom left corner of the graph. I would also like to have the 3rd and 4th axes in there as

[R] subset and boxplots

2008-04-22 Thread Marlin Keith Cox
R users, This should be simple, but I cannot figure it out. I import test.csv, then create a subset for "brook_dis". When I plot (week, R) I get a nice boxplot, but along the x axis, there are weeks a, b, c along with h and nh. Thank you ahead of time. keith rm(list=ls()) cond.exp1<-read.csv("

[R] subset and plot

2008-04-21 Thread Marlin Keith Cox
create a subset for "brook_dis". When I plot (week, R) I get a nice boxplot, but along the x axis, there are weeks a, b, c along with h and nh. Thank you ahead of time. keith rm(list=ls()) cond.exp1<-read.csv("condition/test.csv",header=TRUE) sub<-subset(cond.exp1, Species=="brook_d

[R] addition of matrix

2008-02-19 Thread Marlin Keith Cox
Thank you ahead of time for help with this. I have two matrices X [,1] [,2] [,3] [,4] [,5] [,6] [1,] 660 693.00 726.0 759.00 792.0 825.00 [2,] 548 575.40 602.8 630.20 657.6 685.00 [3,] 676 709.80 743.6 777.40 811.2 845.00 [4,] 763 801.15 839.3 877.45 915.6 953.75 [5,] 768 80

[R] Matrix addition

2008-02-19 Thread Marlin Keith Cox
Matt, I know you are probably busy with work, but I cannot help buy asking you these R questions. If it is bothersome, please let me know and I will stick with the R help... but I have two matrices X [,1] [,2] [,3] [,4] [,5] [,6] [1,] 660 693.00 726.0 759.00 792.0 825.00 [2,] 548

Re: [R] predict.lm with matrix as newdata

2008-02-18 Thread Marlin Keith Cox
3.453*Z+1.994 pred.est1 <- predict.lm(model.lm, data.frame(Rs=Z)) pred.est pred.est1 detach(z) detach(sen) On Sat, Feb 16, 2008 at 2:10 AM, Uwe Ligges <[EMAIL PROTECTED]> wrote: > > > Marlin Keith Cox wrote: > > Z is a matrix and when I run the following line, it creates a pred

[R] wire.frame tick labels from matrix

2008-02-15 Thread Marlin Keith Cox
Dear R Users, close to the end of this I used wireframe to create a 3D plot from a matrix. The x and y axis tick labels (1-6) for each were created from the matrix being a 6X6 matrix. I need the axis tick labels to be the row and column headings which you can see in the output (mat.x). I have tri

[R] predict.lm with matrix as newdata

2008-02-15 Thread Marlin Keith Cox
Z is a matrix and when I run the following line, it creates a prediction estimate using each column, how can I get it an estimate for each individual number. I have tried changing Z to a data.frame, but this does not do it either. model.lm<-lm(w~x) pred.est <- predict.lm(model.lm, data.frame(x=Z