Displaying 20 results from an estimated 10000 matches similar to: "R squared for lm prediction"
2009 Apr 08
2
Doubt about aov and lm function... bug?
Hi,
The below very strange:
# a) aov function
av <- aov(Sepal.Length ~ Species, data=iris)
# Error in parse(text = x) :
# unexpected symbol in "Sepal(Sepal.Length+Species)Length"
av <- aov(iris[, 1] ~ iris[, 5])
# summary(av)
# Df Sum Sq Mean Sq F value Pr(>F)
# iris[, 5] 2 63.2 31.6 119 <2e-16 ***
# Residuals 147 39.0 0.3
# ---
2010 Jan 22
4
Extract R-squared from summary of lm
Dear all,
I cannot find to explicitly get the R-squared or adjusted R-squared from
summary(lm())
Thanks a lot!
[[alternative HTML version deleted]]
2010 Nov 13
2
Factor analysis
Hi all,
This could be very basic. I want to do exploratory factor analysis but I
don't have the data, rather I have the correlation matrix. How do I do this
with just the correlation matrix? I know for principal components, I can
just find the eigen values.
Best regards
--
View this message in context: http://r.789695.n4.nabble.com/Factor-analysis-tp3040618p3040618.html
Sent from the R
2006 May 02
1
Use predict.lm
Hi All,
I created a two variable lm() model
slm<-lm(y[1:3000,8]~y[1:3000,12]+y[1:3000,15])
I made two predictions
predict(slm,newdata=y[201:3200,])
predict(slm,newdata=y[601:3600,])
there is no error message for either of these.
the results are identical, and identical to slm$fitted as well.
if this is not the right way to apply the model coefficients to a new
set of inputs, what is
2019 Aug 30
3
inconsistent handling of factor, character, and logical predictors in lm()
Dear R-devel list members,
I've discovered an inconsistency in how lm() and similar functions handle logical predictors as opposed to factor or character predictors. An "lm" object for a model that includes factor or character predictors includes the levels of a factor or unique values of a character predictor in the $xlevels component of the object, but not the FALSE/TRUE values
2012 Dec 10
3
splitting dataset based on variable and re-combining
I have a dataset and I wish to use two different models to predict. Both models are SVM. The reason for two different models is based
on the sex of the observation. I wish to be able to make predictions and have the results be in the same order as my original dataset. To
illustrate I will use iris:
# Take Iris and create a dataframe of just two Species, setosa and versicolor, shuffle them
2006 May 31
2
a problem 'cor' function
Hi list,
One of my co-workers found this problem with 'cor' in his code and I confirm it too (see below). He's using R 2.2.1 under Win 2K and I'm using R 2.3.0 under Win XP.
===========================================
> R.Version()
$platform
[1] "i386-pc-mingw32"
$arch
[1] "i386"
$os
[1] "mingw32"
$system
[1] "i386, mingw32"
$status
2019 Aug 31
2
inconsistent handling of factor, character, and logical predictors in lm()
Dear Abby,
> On Aug 30, 2019, at 8:20 PM, Abby Spurdle <spurdle.a at gmail.com> wrote:
>
>> I think that it would be better to handle factors, character predictors, and logical predictors consistently.
>
> "logical predictors" can be regarded as categorical or continuous (i.e. 0 or 1).
> And the model matrix should be the same, either way.
I think that
2007 Sep 19
2
By() with method = spearman
I have a data set where I want the correlations between 2 variables
conditional on a students grade level.
This code works just fine.
by(tmp[,c('mtsc07', 'DCBASmathscoreSPRING')], tmp$Grade, cor,
use='complete', method='pearson')
However, this generates an error
by(tmp[,c('mtsc07', 'DCBASmathscoreSPRING')], tmp$Grade, cor,
use='complete',
2012 Apr 25
1
recommended way to group function calls in Sweave
Dear all
When using Sweave, I'm always hitting the same bump: I want to group
repetitive calls in a function, but I want both the results and the
function calls in the printed output. Let me explain myself.
Consider the following computation in an Sweave document:
summary(iris[,1:2])
cor(iris[,1:2])
When using these two calls directly, I obtain the following output:
> summary(iris[,1:2])
2007 Dec 03
1
cor(data.frame) infelicities
In using cor(data.frame), it is annoying that you have to explicitly
filter out non-numeric columns, and when you don't, the error message
is misleading:
> cor(iris)
Error in cor(iris) : missing observations in cov/cor
In addition: Warning message:
In cor(iris) : NAs introduced by coercion
It would be nicer if stats:::cor() did the equivalent *itself* of the
following for a data.frame:
2012 May 05
1
No Data in randomForest predict
I would like to ask a general question about the randomForest predict
function and how it handles No Data values. I understand that you can omit
No Data values while developing the randomForest object, but how does it
handle No Data in the prediction phase? I would like the output to be NA
if any (not just all) of the input data have an NA value. It is not clear
to me if this is the default or
2007 Oct 10
3
save lm output into vectors
Hi,
May I ask how I can save the coefficients and the p values into a table?
thanks.
jiong
The email message (and any attachments) is for the sole...{{dropped:11}}
2006 Jan 29
2
SoS! How to predict new values using linear regression models?
Hi all,
After trial and error by myself for a few hours, I decide to ask for your
help.
I have a training set which is a matrix of size 200 x 2, where the two
columns denote each independent variable. I have 200 observations.
-----------------
ss=data.frame(trainingSet);
result=lm(trainingClass~ss$X1+ss$X2);
-----------------
where trainingClass denotes the true classes of the training data.
2006 Sep 22
3
extract data from lm object and then use again?
Hi list,
I want to write a general function so that it would take an lm object,
extract its data element, then use the data at another R function (eg, glm).
I searched R-help list, and found this would do the trick of the first part:
a.lm$call$data
this would return a name object but could not be recognized as a
data.frameby glm. I also tried
call(as.character(a.lm$call$data))
or
2012 Jul 31
1
kernlab kpca predict
Hi!
The kernlab function kpca() mentions that new observations can be transformed by using predict. Theres also an example in the documentation, but as you can see i am getting an error there (As i do with my own data). I'm not sure whats wrong at the moment. I haven't any predict functions written by myself in the workspace either. I've tested it with using the matrix version and the
2008 Feb 27
2
multiple plots per page using hist and pdf
Hello,
I am puzzled by the behavior of hist() when generating multiple plots
per page on the pdf device. In the following example two pdf files
are generated. The first results in 4 plots on one pdf page as
expected. However, the second, which swaps one of the plot() calls
for hist(), results in a 4 page pdf with one plot per page.
How might I get the histogram with 3 other scatter
2008 Oct 31
4
how to compute a roc curve
Hi,
I'm trying to set up a prediction software, now i testing the performance
of my method, so i need to calculate a ROC curve, specially auc, cut-off,
sens and spec, i just looking at ROCH package, but it's a mass for me, i'm
not a math guy and I'm getting lost
Could any of you recommend me an easy-to-use package to do this task? i just
have a list of positive/negative samples
2006 Mar 16
1
Conditional correlation in R?
hi all,
Suppose I have four variables (X1,X2,Y1,Y2)
I want to calculate conditional correlation of (X1,Y1) given (X2, Y2).
How can I do it in R?
Thanks
Ming Chen
2008 Oct 13
2
split data, but ensure each level of the factor is represented
Hello,
I'll use part of the iris dataset for an example of what I want to
do.
> data(iris)
> iris<-iris[1:10,1:4]
> iris
Sepal.Length Sepal.Width Petal.Length Petal.Width
1 5.1 3.5 1.4 0.2
2 4.9 3.0 1.4 0.2
3 4.7 3.2 1.3 0.2
4 4.6 3.1 1.5