Displaying 20 results from an estimated 5000 matches similar to: "Newbie programming help"
2008 Jun 13
2
Quartile regression question
I have data that looks like
lake,loglength,logweight
1,2.369215857,1.929418926
1,2.426511261,2.230448921
1,2.434568904,2.298853076
1,2.437750563,2.298853076
1,2.442479769,2.230448921
1,2.445604203,2.356025857
...
102,2.722633923,3.310268367
102,2.781755375,3.502153893
102,2.836324116,3.683407299
102,2.802773725,3.583312152
102,2.790285164,3.546419267
102,2.806179974,3.599118565
2008 Jun 10
3
newbie nls question
I'm tyring to fit a relatively simple nls model to some data, but keep coming up against the same error (code follows):
Oto=nls(Otolith ~ Linf*(1-exp(-k(AGE-to))),
data = ages,
start = list(Linf=1000, k=0.1, to=0.1),
trace = TRUE)
The error message I keep getting is "Error in eval(expr, envir, enclos) : could not find function "k"". I've used this
2008 Dec 18
2
Contextstack overlow
All -
I have a number of rows that I am assigning length classes to via
l.class<-with(wae,
ifelse((Length>=120)&(Length<130),"125",
ifelse((Length>=130)&(Length<140),"135",
ifelse((Length>=140)&(Length<150),"145",
ifelse((Length>=150)&(Length<160),"155",
2008 Jun 12
2
Predicting from an nls model
I keep running up against the same error when I try to plot a line from a nls model. The data is fisheries length/weight data. Code follows:
require(graphics)
pow = nls(Weight~alpha*Length^beta, data=wae,
start=list(alpha=0.0000001, beta=3.0), trace=TRUE)
predict(pow)
plot(Weight~Length,
2010 Aug 23
2
Quantile Regression and Goodness of Fit
All -
Does anyone know if there is a method to calculate a goodness-of-fit
statistic for quantile regressions with package quantreg?
Specifically, I'm wondering if anyone has implemented the
goodness-of-fit process developed by Koenker and Machado (1999) for R?
Though I have used package quantreg in the past, I may have overlooked
this function, if it is included.
Citation:
Koenker, R. and
2008 Sep 02
2
nls.control()
All -
I have data:
TL age
388 4
418 4
438 4
428 5
539 10
432 4
444 7
421 4
438 4
419 4
463 6
423 4
...
[truncated]
and I'm trying to fit a simple Von Bertalanffy growth curve with program:
#Creates a Von Bertalanffy growth model
VonB=nls(TL~Linf*(1-exp(-k*(age-t0))), data=box5.4,
start=list(Linf=1000, k=0.1, t0=0.1), trace=TRUE)
#Scatterplot of the data
plot(TL~age, data=box5.4,
2008 Jul 03
1
lm() question
I have data that looks like
YC Age Num
82 11 2
83 10 0
84 9 8
85 8 21
86 7 49
87 6 18
88 5 79
89 4 28
90 3 273
91 2 175
with a program
mod1=lm(log(Num+1)~YC, data=box44)
plot(log(Num+1)~YC, data=box44, pch=19, xlab="Year Class",
ylab="Loge Number at age", ylim=c(0,6), xlim=c(91,82))
abline(lm(log(Num+1)~YC), col="blue", lwd=2)
summary(mod1)
I need to
2008 Aug 29
1
lm() and dffits
All -
My question is a bit involved, so bear with me.
I have some data that looks like:
Lake LL LW
81 2.176091259 1.342422681
81 2.176091259 1.414973348
81 2.176091259 1.447158031
81 2.181843588 1.414973348
81 2.181843588 1.447158031
81 2.184691431 1.462397998
81 2.187520721 1.447158031
81 2.187520721 1.477121255
81 2.187520721 1.505149978
...
[truncated]
I'm trying to:
1) fit a simple
2008 Aug 19
1
Histogram binning
I am trying to produce frequencies in defined intervals however I can't seem
to figure out how to get R to bin my data the way I want it to.
I have several thousand lengths of fish that I want to be binned as follows:
Ex.
Length Bin
209 200
219 210
431 430
727 720
That is, bins with any length equal to or greater than the lower
2008 Oct 24
4
gfortran optimization problems
Colleagues,
I have a routine in package labdsv that calls a FORTRAN subroutine.
Recently, I was informed that it sometimes gives different results on a
PC and Mac, and that the PC version is clearly wrong. I tested it on
linux (because I don't have a PC), and I get the same (incorrect)
behavior as the PC.
Simply by inserting debug WRITE statements in the FORTRAN I would get
different,
2007 Jun 11
1
Rearranging Capture History Data in R
What code can i use to convert a table like this:
Tag# Date
1 1
2 1
3 1
4 1
2 2
4 2
1 3
2 3
4 4
Into one like this:
Tag 1 2 3 4 #Date header
1 1 0 0 1
2 1 1 1 0
3 1 0 0 0
4 1 1 0 1
Thanks,
Ben Cox
Research Assistant (M.S.)
Montana Cooperative
2005 Nov 09
6
elements in a matrix to a vector
hi all,
i'm trying to get elements in a matrix into a vector. i need a
"streamlined" way to do it as the way i'm doing it is not very
serviceable. an example is a 3x3 matrix like
0 0 3
2 0 0
0 4 0
to a vector like
3 2 4
thanks...mj
[[alternative HTML version deleted]]
2008 Jul 03
1
lines() warning message
I have data that looks like
Year,Recruit,Spawner,Mtempcv
1958,4532,775,0.24125
1959,22996,2310,0.16319
1960,628,2990,0.46056
1961,879,1400,0.33028
1962,14747,1130,0.22618
1963,13205,790,0.20596
1964,31793,1195,0.19229
1965,10621,981,0.20363
1966,22271,870,0.3452
1967,8736,1104,0.27511
1968,8761,883,0.10884
1969,18885,1421,0.17799
1970,10098,1198,0.2106
1971,3394,760,0.22098
1972,1697,1354,0.39461
2008 Dec 22
3
Summary information by groups programming assitance
All -
I have data that looks like
psd Species Lake Length Weight St.weight Wr
Wr.1 vol
432 substock SMB Clear 150 41.00 0.01 95.12438
95.10118 0.0105
433 substock SMB Clear 152 39.00 0.01 86.72916
86.70692 0.0105
434 substock SMB Clear 152 40.00 3.11 88.95298
82.03689 3.2655
435 substock SMB Clear
2005 Nov 04
1
Stress in multidimensional scaling
Hello,
We are trying to find a function to compute "stress" in our
multidimensional scaling analysis of a dissimilarity matrix. We've used
"dist()" to create the matrix and "cmdscale()" for the scaling. In order
to determine the number of dimensions we would like to plot stress vs.
dimensions. However, we cannot find a pre-made command. It seems that
other
1997 Aug 29
1
R-beta: ar
I have been trying to get a working version of ar, since I have used it
in several calculations in the test suite for my time series library.
The following limited version (order.max must be specified and other
short comings) works more or less, but the results differ by more than
I would expect from those given by Splus. I have tried several
variations with no success. If anyone can see a reason
2007 Nov 16
4
Permutation of a distance matrix
Hi there,
I would like to find a more efficient way of permuting the rows and columns of a symmetrical matrix that represents ecological or actual distances between objects in space. The permutation is of the type used in a Mantel test.
Specifically, the permutation has to accomplish something like this:
Original matrix addresses:
a11 a12 a13
a21 a22 a23
a31 a32 a33
Example
2006 Feb 10
1
3-d splinefun
hello,
is it possible to do something like splinefun(x,y), but with a 3rd
dim?
for example, if i have a 2-dim system like:
x<-1:100
y<-rexp(100,1)
func<-splinefun(x,sort(y))
func(n) # returns interpolated value of y (after sorting) given x=n
# i can check this by:
plot(x,sort(y))
lines(spline(x,sort(y)))
Can i do the same thing with an x,y, and z? i have found the akima
2006 Jan 17
1
Clustering function
Dear mailing group,
I have loaded an Excel file into R by calling it ".csv" and using the
"read.csv" function in R. However then I want to use the (limma package
specific, I believe) function "hclust", which clusters data in a tree
dendrogram, by similarity. However, I receive the errors msg.s: 1) "missing
observations in cov/cor" 2) "In
2006 Jan 25
1
combining variables with PCA
hello R_team
having perfomed a PCA on my fitted model with the function:
data<- na.omit(dataset)
data.pca<-prcomp(data,scale =TRUE),
I´ve decided to aggregate two variables that are highly correlated.
My first question is:
How can I combine the two variables into one new predictor?
and secondly:
How can I predict with the newly created variable in a new dataset?
Guess I need the