similar to: apply vs sapply vs loop - lm() call appl(y)ied on array

Displaying 20 results from an estimated 3000 matches similar to: "apply vs sapply vs loop - lm() call appl(y)ied on array"

2003 Feb 26
1
calculationg condition numbers
am I right in the assumption, that for calculation of the condition numbers I have to use the correlation matrix of X, and not t(x) %*% x? > e <- eigen(t(x) %*% x) better (x must not have a first column of ones): > e <- eigen(cor(x)) > e$val [1] 6.6653e+07 2.0907e+05 1.0536e+05 1.8040e+04 2.4557e+01 2.0151e+00 > sqrt(e$val[1]/e$val) [1] 1.000 17.855 25.153 60.785 1647.478
2003 Feb 22
4
faraway tutorial: cryptic command to newbie
I am just about working through Faraways excellent tutorial "practical regression and ANOVA using R" on page 24 he makes the x matrix: x <- cbind(1,gala[,-c(1,2)]) how can I understand this gala[,-c(1,2)])... I couldn't find an explanation of such "c-like" abbreviations anywhere. thanks for a hint. another problem: I couldn't load the faraway library, using the
2003 Feb 26
1
plot as .ps file: where are the axes and labels gone
Sorry, I am sure, this must be documented somewhere (but there are that many docs and tutorials to scan for topics..., actually a great thing... but if you are in a hurry..): I want to save a plot as .ps (or .eps): > postscript("plot1.eps", horizontal=FALSE, onefile=FALSE,height=8,width=8,pointsize=10) > plot(hpfit$fit,rstudent(hpfit),xlab="Fitted
2012 Mar 18
1
Help with dlply, loop and column names
Hi, I have a dataframe basically like this: > head(asturias.gen2011[,c(1,4,9:14)]) municipio total upyd psoe pp iu fac tipo 440 Allande 2031 1.44 31.10 39.75 4.01 21.62 1000-10000 443 Aller 12582 1.37 33.30 37.09 15.53 10.35 10000-50000 567 Amieva 805 1.48 32.69 37.36 6.15 20.16 <1000 849
2004 Sep 23
0
nnet and weights: error analysis using V&R example
Dear R-users, dear Prof. Ripley as package maintainer I tried to investigate the odd error, when I call nnet together with a 'weights' parameter, using the 'fgl' example in V&R p 348 The error I get is: Error in eval(expr, envir, enclos) : Object "w" not found I think it is a kind of scoping problem, but I really cannot see, what the problem exactly is. and
2004 Sep 23
0
nnet with weights parameter: odd error
Dear R-users I use nnet for a classification (2 classes) problem. I use the code CVnn1, CVnn2 as described in V&R. The thing I changed to the code is: I define the (class) weight for each observation in each cv 'bag' and give the vector of weights as parameter of nnet(..weights = weight.vector...) Unfortunately I get an error during some (but not all!) inner-fold cv runs:
2004 Mar 30
1
classification with nnet: handling unequal class sizes
I hope this question is adequate for this list I use the nnet code from V&R p. 348: The very nice and general function CVnn2() to choose the number of hidden units and the amount of weight decay by an inner cross-validation- with a slight modification to use it for classification (see below). My data has 2 classes with unequal size: 45 observations for classI and 116 obs. for classII With
2017 Aug 16
1
Bias-corrected percentile confidence intervals
Hi folks, I'm trying to estimate bias-corrected percentile (BCP) confidence intervals on a vector from a simple for loop used for resampling. I am attempting to follow steps in Manly, B. 1998. Randomization, bootstrap and monte carlo methods in biology. 2nd edition., p. 48. PDF of the approach/steps should be available here: https://wyocoopunit.box.com/s/9vm4vgmbx5h7um809bvg6u7wr392v6i9 If
2003 Sep 26
2
overlay two pixmap
Hi I need to overlay two pixmaps (library (pixmap)). One, a pixmapGrey, is the basis, and on this I need to overlay a pixmapIndexed, BUT: the pixmapIndexed has set only some of its "pixels" to an indexed color, many of its pixels should not cover the basis pixmapGrey pixel, means, for this "in pixmapIndexed not defined pixels" it should be transparent. What would you
2009 Mar 13
1
lsfit w/ rank-deficient x
Dear R-devel, It seems that lsfit incorrectly reports coefficients when the input matrix 'x' is rank-deficient, see the example below: ## here values of 'b' and 'c' are incorrectly swapped > x <- cbind(a=rnorm(100), b=0, c=rnorm(100)); y <- rnorm(100); lsfit(x, y)$coef Intercept a b c -0.0227787 0.1042860 -0.1729261 0.0000000 Warning
2006 Sep 12
4
variables in object names
Is there any way to put an argument into an object name. For example, say I have 5 objects, model1, model2, model3, model4 and model5. I would like to make a vector of the r.squares from each model by code such as this: rsq <- summary(model1)$r.squared for(i in 2:5){ rsq <- c(rsq, summary(model%i%)$r.squared) } So I assign the first value to rsq then cycle through models 2 through
2004 Nov 29
2
problem with using transace
>I am trying to use the Hmisc function transace to transform predictors > > test<-cbind(flowstress,pressres,alloy) > xtrans<-transace(x,binary=pressres',monotonic='flowstress', categorical='alloy') > > >and I am getting the following message?? >Error in ace(x[, -i], x[, i], monotone = im, categorical = ic) : > unused argument(s) (monotone ...)
2009 Oct 25
1
lsfit residuals
I'm trying to extract the points above and below a particular lsfit. I can only get the residuals from the original fit though. x = runif(100, 0, 10) plot(x) abline(lsfit(1:100, test)) abline(lsfit(1:100, test + sd(test))) #I want the points above THIS line. Is there a way to use the coefficients from the fit to do this? Thanks for any help.
2003 Jul 21
5
how to test whether two slopes are sign. different?
Not really r-specific: Z = (b1 - b2) / SQRT ( SEb1^2 + SEb2^2) -------Original Message------- From: Gijsbert Stoet <stoet at volition.wustl.edu> Sent: 07/20/03 09:51 PM To: r-help at stat.math.ethz.ch Subject: [R] how to test whether two slopes are sign. different? > > Hi, suppose I do want to test whether the slopes (e.g. determined with lsfit) of two different population are
2002 May 14
1
princomp
Hello experts, as newcomer in pca, i have a question, concerning the princomp algorithm. With a dataset "r" containing 18 "input" parameters and 1 "output" parameter r[19], i got with the following fit ls <- lsfit(r[1:18],r[19]); lsdiag <- ls.diag(ls); lsdiag$std.dev a prediction error of: [1] 8.879561 what is quite reasonable. If i take only two
2010 Oct 04
2
i have aproblem --thank you
dear professor: thank you for your help,witn your help i develop the nomogram successfully. after that i want to do the internal validation to the model.i ues the bootpred to do it,and then i encounter problem again,just like that.(´íÎóÓÚerror to :complete.cases(x, y, wt) : ²»ÊÇËùÓеIJÎÊý¶¼Ò»Ñù³¤(the length of the augment was different)) i hope you tell me where is the mistake,and maybe i have
1997 Apr 30
1
R-beta: ls.print
ls.print produces error that I don't seem to be able to trace. Output of the commands as follows: (hyeung is a 24x2 matrix of data) ------------------------------------------------- > summary(hyeung) x.1 x.2 Min. : 28.0 Min. : 10.0 1st Qu.: 72.0 1st Qu.: 87.5 Median : 86.5 Median : 92.5 Mean : 81.0 Mean : 82.5 3rd Qu.: 97.0 3rd Qu.:100.0 Max.
1997 Apr 30
1
R-beta: ls.print
ls.print produces error that I don't seem to be able to trace. Output of the commands as follows: (hyeung is a 24x2 matrix of data) ------------------------------------------------- > summary(hyeung) x.1 x.2 Min. : 28.0 Min. : 10.0 1st Qu.: 72.0 1st Qu.: 87.5 Median : 86.5 Median : 92.5 Mean : 81.0 Mean : 82.5 3rd Qu.: 97.0 3rd Qu.:100.0 Max.
2010 Jun 29
1
Model validation and penalization with rms package
I?ve been using Frank Harrell?s rms package to do bootstrap model validation. Is it the case that the optimum penalization may still give a model which is substantially overfitted? I calculated corrected R^2, optimism in R^2, and corrected slope for various penalties for a simple example: x1 <- rnorm(45) x2 <- rnorm(45) x3 <- rnorm(45) y <- x1 + 2*x2 + rnorm(45,0,3) ols0 <- ols(y
2016 Apr 20
6
Solving sparse, singular systems of equations
I have a situation in R where I would like to find any x (if one exists) that solves the linear system of equations Ax = b, where A is square, sparse, and singular, and b is a vector. Here is some code that mimics my issue with a relatively simple A and b, along with three other methods of solving this system that I found online, two of which give me an error and one of which succeeds on the